|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> store >> raw >> [ data overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.store.raw.data
Class RememberBytesInputStream

java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
org.apache.derby.impl.store.raw.data.RememberBytesInputStream
- All Implemented Interfaces:
- java.io.Closeable
- public class RememberBytesInputStream
- extends java.io.FilterInputStream
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.
| Field Summary | |
(package private) ByteHolder |
bh
|
(package private) boolean |
recording
|
| Fields inherited from class java.io.FilterInputStream |
in |
| Constructor Summary | |
RememberBytesInputStream(java.io.InputStream in,
ByteHolder bh)
Construct a RememberBytesInputStream. |
|
| Method Summary | |
int |
available()
Return the number of bytes remains in the byteHolder for reading, without setting the write/read mode. |
void |
clear()
Clear all the remembered bytes. |
long |
fillBuf(int len)
read len bytes from the input stream, and store it in the byte holder. |
ByteHolder |
getByteHolder()
Get the byteHolder. |
java.io.InputStream |
getReplayStream()
Get an input stream for re-reading the remembered bytes. |
int |
numBytesSaved()
Return the number of bytes that have been saved to this byte holder. |
int |
putBuf(java.io.OutputStream out,
int len)
read len bytes from the byte holder, and write it to the output stream. |
int |
read()
Calls the in.read() method |
int |
read(byte[] b,
int off,
int len)
Calls the in.read(byte[], int, int) method. |
boolean |
recording()
Return true iff this RememberBytesInputStream is in recording mode. |
void |
setInput(java.io.InputStream in)
Set the InputStream from which this reads. |
int |
shiftToFront()
remove the remaining bytes in the byteHolder to the beginning set the position to start recording just after these bytes. |
long |
skip(long count)
Calls the in.skip(long) method |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.io.FilterInputStream |
close, mark, markSupported, read, reset |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
bh
ByteHolder bh
recording
boolean recording
| Constructor Detail |
RememberBytesInputStream
public RememberBytesInputStream(java.io.InputStream in, ByteHolder bh)
- Construct a RememberBytesInputStream.
| Method Detail |
read
public int read()
throws java.io.IOException
- Description copied from class:
java.io.FilterInputStream - Calls the
in.read()method
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Description copied from class:
java.io.FilterInputStream - Calls the
in.read(byte[], int, int)method.
fillBuf
public long fillBuf(int len)
throws java.io.IOException
- read len bytes from the input stream, and store it in the byte holder.
putBuf
public int putBuf(java.io.OutputStream out, int len) throws java.io.IOException
- read len bytes from the byte holder, and write it to the output stream.
skip
public long skip(long count)
throws java.io.IOException
- Description copied from class:
java.io.FilterInputStream - Calls the
in.skip(long)method
getReplayStream
public java.io.InputStream getReplayStream() throws java.io.IOException
- Get an input stream for re-reading the remembered bytes.
getByteHolder
public ByteHolder getByteHolder() throws java.io.IOException
- Get the byteHolder.
clear
public void clear()
throws java.io.IOException
- Clear all the remembered bytes. This stream will
remember any bytes read after this call.
setInput
public void setInput(java.io.InputStream in)
- Set the InputStream from which this reads.
Please note this does not clear remembered bytes.
recording
public boolean recording()
- Return true iff this RememberBytesInputStream is
in recording mode.
available
public int available()
throws java.io.IOException
- Return the number of bytes remains in the byteHolder
for reading, without setting the write/read mode.
numBytesSaved
public int numBytesSaved()
throws java.io.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.
shiftToFront
public int shiftToFront()
throws java.io.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.
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> store >> raw >> [ data overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC