RandomAccessReadDataStream,
this class doesn't pre-load RandomAccessRead into a byte[],
it works with RandomAccessRead directly.
Performance: it is much faster if most of the buffer is skipped, and slower if whole buffer is read()
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final long | |
| private final RandomAccessRead |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public RandomAccessRead | createSubView(long length)
Overrides org. Creates a view from current position to |
| public long | getCurrentPosition()
Implements abstract org. Get the current position in the stream. |
| public InputStream | getOriginalData()
Implements abstract org. Lifetime of returned InputStream is bound by |
| public long | getOriginalDataSize()
Implements abstract org. This will get the original data size that was used for this stream. |
| public int | |
| public int | read(byte[]
The buffer to write to. b, int The offset into the buffer. off, int The length into the buffer. len)Implements abstract org.
|
| private int | |
| public final long | |
| public void | seek(long
The position to seek to. pos)Implements abstract org. Seek into the datasource. |
| length | back to summary |
|---|---|
| private final long length | |
| randomAccessRead | back to summary |
|---|---|
| private final RandomAccessRead randomAccessRead | |
| RandomAccessReadUnbufferedDataStream | back to summary |
|---|---|
pack-priv RandomAccessReadUnbufferedDataStream(RandomAccessRead randomAccessRead) throws IOException
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Close the underlying resources.
| |
| createSubView | back to summary |
|---|---|
| public RandomAccessRead createSubView(long length) Overrides org. Doc from org. Creates a view from current position to
| |
| getCurrentPosition | back to summary |
|---|---|
| public long getCurrentPosition() throws IOException Implements abstract org. Doc from org. Get the current position in the stream.
| |
| getOriginalData | back to summary |
|---|---|
| public InputStream getOriginalData() throws IOException Implements abstract org. Doc from org. Lifetime of returned InputStream is bound by
| |
| getOriginalDataSize | back to summary |
|---|---|
| public long getOriginalDataSize() Implements abstract org. Doc from org. This will get the original data size that was used for this stream.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract org. Doc from org. Read an unsigned byte.
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Implements abstract org.
| |
| readInt | back to summary |
|---|---|
| private int readInt() throws IOException | |
| readLong | back to summary |
|---|---|
| public final long readLong() throws IOException Implements abstract org. Doc from org. Read an unsigned byte.
| |
| seek | back to summary |
|---|---|
| public void seek(long pos) throws IOException Implements abstract org. Doc from org. Seek into the datasource.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final RandomAccessReadView |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. Closes this input stream and releases any system resources associated with the stream. |
| public int | read()
Implements abstract java. Reads the next byte of data from the input stream. |
| public int | read(byte[]
the buffer into which the data is read. b)Overrides java. Reads some number of bytes from the input stream and stores them into
the buffer array |
| 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 long | skip(long
the number of bytes to be skipped. n)Overrides java. Skips over and discards |
| randomAccessRead | back to summary |
|---|---|
| private final RandomAccessReadView randomAccessRead | |
| RandomAccessReadNonClosingInputStream | back to summary |
|---|---|
| public RandomAccessReadNonClosingInputStream(RandomAccessReadView randomAccessRead) | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this input stream and releases any system resources associated with the stream.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract 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) throws IOException Overrides java. Doc from java. Reads some number of bytes from the input stream and stores them into
the buffer array If the length of The first byte read is stored into element
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Overrides java. Doc from java. Reads up to This method blocks until input data is available, end of file is detected, or an exception is thrown. If The first byte read is stored into element In every case, elements
| |
| skip | back to summary |
|---|---|
| public long skip(long n) throws IOException Overrides java. Doc from java. Skips over and discards
| |