Package com.drew.lang
Class RandomAccessStreamReader
java.lang.Object
com.drew.lang.RandomAccessReader
com.drew.lang.RandomAccessStreamReader
- Author:
- Drew Noakes https://drewnoakes.com
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRandomAccessStreamReader(InputStream stream) RandomAccessStreamReader(InputStream stream, int chunkLength) RandomAccessStreamReader(InputStream stream, int chunkLength, long streamLength) -
Method Summary
Modifier and TypeMethodDescriptionbytegetByte(int index) Gets the byte value at the specified byteindex.byte[]getBytes(int index, int count) Returns the required number of bytes from the specified index from the underlying source.longReads to the end of the stream, in order to determine the total number of bytes.inttoUnshiftedOffset(int localOffset) Methods inherited from class com.drew.lang.RandomAccessReader
getBit, getDouble64, getFloat32, getInt16, getInt24, getInt32, getInt64, getInt8, getNullTerminatedBytes, getNullTerminatedString, getNullTerminatedStringValue, getS15Fixed16, getString, getString, getStringValue, getUInt16, getUInt32, getUInt8, isMotorolaByteOrder, setMotorolaByteOrder
-
Field Details
-
DEFAULT_CHUNK_LENGTH
public static final int DEFAULT_CHUNK_LENGTH- See Also:
-
-
Constructor Details
-
RandomAccessStreamReader
-
RandomAccessStreamReader
-
RandomAccessStreamReader
-
-
Method Details
-
getLength
Reads to the end of the stream, in order to determine the total number of bytes. In general, this is not a good idea for this implementation ofRandomAccessReader.- Specified by:
getLengthin classRandomAccessReader- Returns:
- the length of the data source, in bytes.
- Throws:
IOException
-
toUnshiftedOffset
public int toUnshiftedOffset(int localOffset) - Specified by:
toUnshiftedOffsetin classRandomAccessReader
-
getByte
Description copied from class:RandomAccessReaderGets the byte value at the specified byteindex.Implementations should not perform any bounds checking in this method. That should be performed in
validateIndexandisValidIndex.- Specified by:
getBytein classRandomAccessReader- Parameters:
index- The index from which to read the byte- Returns:
- The read byte value
- Throws:
BufferBoundsException- if the requested byte is beyond the end of the underlying data sourceIOException- if the byte is unable to be read
-
getBytes
Description copied from class:RandomAccessReaderReturns the required number of bytes from the specified index from the underlying source.- Specified by:
getBytesin classRandomAccessReader- Parameters:
index- The index from which the bytes begins in the underlying sourcecount- The number of bytes to be returned- Returns:
- The requested bytes
- Throws:
BufferBoundsException- if the requested bytes extend beyond the end of the underlying data sourceIOException- if the byte is unable to be read
-