|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Reader
org.wso2.carbon.registry.core.jdbc.utils.DumpReader
public class DumpReader
A wrapper for the Reader that will cache the extra bytes consumed by xml stream reader in registry.restore(path, reader) operation which restore the resources from a dump.xml This keep track of the actual reading child resource (using setReadingChildResourceIndex) and consuming child resource with normal read functions, if the consumed ones have higher values than actually reading ones, this will buffer the extra bytes and release it after actual reading ones finished using it.
Field Summary |
---|
Fields inherited from class java.io.Reader |
---|
lock |
Constructor Summary | |
---|---|
DumpReader(java.io.Reader reader)
Constructor of the Dump Reader wrapping another reader. |
Method Summary | |
---|---|
void |
close()
Close the stream. |
static int |
getMaxBufferedSize()
Return the maximum size of the buffer when reading from the main reader. |
static int |
getTotalBuffered()
Return the total number of buffered bytes from the main reader. |
static int |
getTotalBufferedRead()
Return the total number of bytes read from the buffer (buffered when reading from the main reader) |
static int |
getTotalRead()
Return the total number of read bytes from the main reader. |
boolean |
isLastResource(int readingChildResourceIndex)
To check whether the stream is in the last child resource. |
int |
read()
Read a single character. |
int |
read(char[] cBuf,
int off,
int len)
Read characters into a portion of an array. |
boolean |
ready()
Tell whether this stream is ready to be read. |
void |
setCheckingChildByParent(boolean checkingChildByParent)
Set whether the check is done by the parent, in that case we buffer all the bytes read since they will be re-read from the child side anyway. |
void |
setReadingChildResourceIndex(int readingChildResourceIndex)
Set the reading child index |
Methods inherited from class java.io.Reader |
---|
mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DumpReader(java.io.Reader reader)
reader
- the wrapped reader, could be file reader, http reader or another dump readerMethod Detail |
---|
public int read(char[] cBuf, int off, int len) throws java.io.IOException
read
in class java.io.Reader
cBuf
- destination bufferoff
- offset at which to start storing characterslen
- maximum number of characters to read
java.io.IOException
- if an I/O error occurspublic int read() throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
- if an I/O error occurspublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.Reader
java.io.IOException
- if an I/O error occurspublic void setReadingChildResourceIndex(int readingChildResourceIndex)
readingChildResourceIndex
- the reading child indexpublic void setCheckingChildByParent(boolean checkingChildByParent)
checkingChildByParent
- true if child is checked by parent, false otherwisepublic boolean isLastResource(int readingChildResourceIndex) throws java.io.IOException
readingChildResourceIndex
- the reading child index
java.io.IOException
- throws if the operation failed.public boolean ready() throws java.io.IOException
ready
in class java.io.Reader
java.io.IOException
- if an I/O error occurspublic static int getTotalRead()
public static int getTotalBuffered()
public static int getMaxBufferedSize()
public static int getTotalBufferedRead()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |