|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Holder for a growing sequence of bytes. The ByteHolder supports a writing phase in which a caller appends bytes to the ByteHolder. Later the caller may read the bytes out of the ByteHolder in the order they were written.
Method Summary | |
int |
available()
Return the number of bytes that can be read from this ByteHolder without blocking on an IO. |
void |
clear()
Clear the bytes from the ByteHolder and place it in writing mode. |
int |
numBytesSaved()
Return the number of bytes that have been saved to this byte holder. |
int |
read()
Read a byte from this ByteHolder. |
int |
read(byte[] b,
int off,
int len)
Read up to 'len' bytes from this ByteHolder and store them in an array at offset 'off'. |
int |
read(java.io.OutputStream out,
int len)
Read up to 'len' bytes from this ByteHolder and write them to the OutputStream The ByteHolder must be in reading mode to call this. |
int |
shiftToFront()
shift the remaining unread bytes to the beginning of the byte holder |
long |
skip(long count)
Skip over the specified number of bytes in a ByteHolder. |
void |
startReading()
Place a ByteHolder in reading mode. |
void |
write(byte[] data,
int offset,
int len)
Write len bytes of data starting at 'offset' to this ByteHolder. |
long |
write(java.io.InputStream in,
long count)
Write up to count bytes from an input stream to this ByteHolder. |
void |
write(int b)
Write a byte to this ByteHolder. |
boolean |
writingMode()
Return true if this is in writing mode. |
Method Detail |
public void write(int b) throws java.io.IOException
The ByteHolder must be in writing mode to call this.
java.io.IOException
public void write(byte[] data, int offset, int len) throws java.io.IOException
The ByteHolder must be in writing mode to call this.
java.io.IOException
public long write(java.io.InputStream in, long count) throws java.io.IOException
java.io.IOException
- thrown when reading in causes an
error.public void clear() throws java.io.IOException
java.io.IOException
public void startReading() throws java.io.IOException
java.io.IOException
public int read() throws java.io.IOException
The ByteHolder must be in reading mode to call this.
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
The ByteHolder must be in reading mode to call this.
java.io.IOException
public int read(java.io.OutputStream out, int len) throws java.io.IOException
The ByteHolder must be in reading mode to call this.
java.io.IOException
public int shiftToFront() throws java.io.IOException
java.io.IOException
public int available() throws java.io.IOException
java.io.IOException
public int numBytesSaved() throws java.io.IOException
java.io.IOException
public long skip(long count) throws java.io.IOException
java.io.IOException
public boolean writingMode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |