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.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv ByteHolder | |
| pack-priv boolean | |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| public | RememberBytesInputStream(InputStream in, ByteHolder
for storing the remembered bytes. (must be
in writing mode. bh)Construct a RememberBytesInputStream. |
| Modifier and Type | Method and Description |
|---|---|
| public int | available()
Overrides java. Return the number of bytes remains in the byteHolder for reading, without setting the write/read mode. |
| public void | |
| public long | |
| public ByteHolder | |
| public InputStream | |
| public int | |
| public int | putBuf(OutputStream out, int len)
read len bytes from the byte holder, and write it to the output stream. |
| public int | |
| public int | read(byte[]
the buffer into which the data is read. b, int the start offset in array off, int b
at which the data is written.the maximum number of bytes to read. len)Overrides java. Reads up to |
| public boolean | |
| public void | |
| 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
the number of bytes to be skipped. count)Overrides java. Skips over and discards |
| public String |
| bh | back to summary |
|---|---|
| pack-priv ByteHolder bh | |
| recording | back to summary |
|---|---|
| pack-priv boolean recording | |
| streamClosed | back to summary |
|---|---|
| pack-priv boolean streamClosed | |
| RememberBytesInputStream | back to summary |
|---|---|
| public RememberBytesInputStream(InputStream in, ByteHolder bh) Construct a RememberBytesInputStream.
| |
| available | back to summary |
|---|---|
| public int available() throws IOException Overrides java. Return the number of bytes remains in the byteHolder for reading, without setting the write/read mode.
| |
| clear | back to summary |
|---|---|
| public void clear() throws IOException Clear all the remembered bytes. This stream will remember any bytes read after this call.
| |
| fillBuf | back to summary |
|---|---|
| public long fillBuf(int len) throws IOException 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
| |
| getByteHolder | back to summary |
|---|---|
| public ByteHolder getByteHolder() throws IOException Get the byteHolder. | |
| getReplayStream | back to summary |
|---|---|
| public InputStream getReplayStream() throws IOException Get an input stream for re-reading the remembered bytes. | |
| numBytesSaved | back to summary |
|---|---|
| public int numBytesSaved() throws IOException 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 | back to summary |
|---|---|
| public int putBuf(OutputStream out, int len) throws IOException read len bytes from the byte holder, and write it to the output stream.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Overrides java. Doc from java. Reads the next byte of data from the input stream. The value byte is
returned as an
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Overrides java. Doc from java. Reads up to
| |
| recording | back to summary |
|---|---|
| public boolean recording() Return true iff this RememberBytesInputStream is in recording mode. | |
| setInput | back to summary |
|---|---|
| public void setInput(InputStream in) Set the InputStream from which this reads. Please note this does not clear remembered bytes. | |
| shiftToFront | back to summary |
|---|---|
| public int shiftToFront() throws IOException 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. | |
| skip | back to summary |
|---|---|
| public long skip(long count) throws IOException Overrides java. Doc from java. Skips over and discards
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |