| java.lang.Object java.io.InputStream java.io.FilterInputStream org.apache.derby.impl.store.raw.data.RememberBytesInputStream
RememberBytesInputStream | public class RememberBytesInputStream extends FilterInputStream (Code) | | A FilterInputStream that remembers read or skipped bytes.
In record mode this stream remembers all the bytes a
caller reads or skips. After reading some bytes this
returns a 'replay' stream to re-read them.
A caller may call getReplaySteam to get a stream
to re-read the the remembered bytes. Any number of calls
to getReplayStream are supported.
The clear function causes this stream to forget the remembered
bytes and re-enter record mode.
|
Method Summary | |
public int | available() Return the number of bytes remains in the byteHolder
for reading, without setting the write/read mode. | public void | clear() Clear all the remembered bytes. | public long | fillBuf(int len) read len bytes from the input stream, and store it in the byte holder. | public ByteHolder | getByteHolder() Get the byteHolder. | public InputStream | getReplayStream() Get an input stream for re-reading the remembered bytes. | public int | numBytesSaved() Return the number of bytes that have been saved to this byte holder. | public int | putBuf(OutputStream out, int len) read len bytes from the byte holder, and write it to the output stream. | public int | read() | public int | read(byte b, int off, int len) | public boolean | recording() Return true iff this RememberBytesInputStream is
in recording mode. | public void | setInput(InputStream in) Set the InputStream from which this reads. | public int | shiftToFront() remove the remaining bytes in the byteHolder to the beginning
set the position to start recording just after these bytes. | public long | skip(long count) | public String | toString() |
recording | boolean recording(Code) | | |
streamClosed | boolean streamClosed(Code) | | |
RememberBytesInputStream | public RememberBytesInputStream(InputStream in, ByteHolder bh)(Code) | | Construct a RememberBytesInputStream.
Parameters: bh - for storing the remembered bytes. (must bein writing mode. |
available | public int available() throws IOException(Code) | | Return the number of bytes remains in the byteHolder
for reading, without setting the write/read mode.
|
clear | public void clear() throws IOException(Code) | | Clear all the remembered bytes. This stream will
remember any bytes read after this call.
exception: IOException - thrown on an io error clearing backingstorage. |
fillBuf | public long fillBuf(int len) throws IOException(Code) | | read len bytes from the input stream, and store it in the byte holder.
Note, fillBuf does not return negative values, if there are no
bytes to store in the byteholder, it will return 0
exception: IOException - thrown on an io error spooling rememberd bytesto backing storage. |
numBytesSaved | public int numBytesSaved() throws IOException(Code) | | Return the number of bytes that have been saved to this byte holder.
This result is different from available() as it is unaffected by the
current read position on the ByteHolder.
|
putBuf | public int putBuf(OutputStream out, int len) throws IOException(Code) | | read len bytes from the byte holder, and write it to the output stream.
exception: IOException - thrown on an io error spooling rememberd bytesto backing storage. |
recording | public boolean recording()(Code) | | Return true iff this RememberBytesInputStream is
in recording mode.
|
setInput | public void setInput(InputStream in)(Code) | | Set the InputStream from which this reads.
Please note this does not clear remembered
bytes.
|
shiftToFront | public int shiftToFront() throws IOException(Code) | | remove the remaining bytes in the byteHolder to the beginning
set the position to start recording just after these bytes.
returns how many bytes was transfered to the beginning.
|
|
|