| java.lang.Object java.io.InputStream org.apache.xerces.utils.ChunkyByteArray
ChunkyByteArray | final public class ChunkyByteArray extends InputStream (Code) | | This class is used for accessing the data provided by an InputStream.
There are two ways in which this class is used. The first occurs
when we are prescanning the start of the stream to determine the
encoding being used. Since we do not require that the stream be
positionable, we wrap it with an instance of this class. The first
"chunk" of the file is read and the data may be accessed directly
using the byteAt(offset) method. After we have determined the
encoding of the byte stream, the instance of this class is passed
on to the EntityReader that will process the data for the scanner.
At this point, the reader may continue to access this instance using
the byteAt method, which will continue to read the contents into
chunks as required until end of input. An example of this is the
UCSReader.
Alternatively, the reader may access this instance as an InputStream
which will first return any data that has been reading into the
chunks, and will then return the remaining data from the original
InputStream directly.
|
Method Summary | |
public boolean | atEOF(int offset) Test to see if an offset is at the end of the input data.
Parameters: offset - A position in the data stream. | public byte | byteAt(int offset) Return a byte of input data at the given offset.
Parameters: offset - The offset in the data stream. | public void | close() | public int | read() Read a byte. | public int | read(byte buffer, int offset, int length) Read bytes.
Parameters: buffer - The destination for the bytes returned. | public void | rewind() Reset position within the data stream back to
the very beginning. |
ChunkyByteArray | public ChunkyByteArray(InputStream is) throws IOException(Code) | | Constructor
Reads the first chunk.
Parameters: is - The input stream containing the data of the entity. |
atEOF | public boolean atEOF(int offset)(Code) | | Test to see if an offset is at the end of the input data.
Parameters: offset - A position in the data stream. true if the position is at the end of the data stream;false otherwise. |
byteAt | public byte byteAt(int offset) throws IOException(Code) | | Return a byte of input data at the given offset.
Parameters: offset - The offset in the data stream. The byte at the specified position within the data stream. |
read | public int read() throws IOException(Code) | | Read a byte.
The next byte of the input data or -1 if there is no more data. |
read | public int read(byte buffer, int offset, int length) throws IOException(Code) | | Read bytes.
Parameters: buffer - The destination for the bytes returned. If null, thenthe data will discarded instead of returned. Parameters: offset - The offset within the buffer where the first returnedbyte should be placed. Parameters: length - The maximum number of bytes to place in the buffer or discard. The number of bytes actually placed in the buffer or discarded. |
rewind | public void rewind()(Code) | | Reset position within the data stream back to
the very beginning.
|
|
|