public class StreamReader extends SequentialReader
| Modifier and Type | Field and Description |
|---|---|
private long |
_pos |
private java.io.InputStream |
_stream |
| Constructor and Description |
|---|
StreamReader(java.io.InputStream stream) |
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns an estimate of the number of bytes that can be read (or skipped
over) from this
SequentialReader without blocking by the next
invocation of a method for this input stream. |
byte |
getByte()
Gets the next byte in the sequence.
|
void |
getBytes(byte[] buffer,
int offset,
int count)
Retrieves bytes, writing them into a caller-provided buffer.
|
byte[] |
getBytes(int count)
Returns the required number of bytes from the sequence.
|
long |
getPosition() |
void |
skip(long n)
Skips forward in the sequence.
|
private long |
skipInternal(long n) |
boolean |
trySkip(long n)
Skips forward in the sequence, returning a boolean indicating whether the skip succeeded, or whether the sequence ended.
|
getDouble64, getFloat32, getInt16, getInt32, getInt64, getInt8, getNullTerminatedBytes, getNullTerminatedString, getNullTerminatedStringValue, getS15Fixed16, getString, getString, getString, getStringValue, getUInt16, getUInt32, getUInt8, isMotorolaByteOrder, setMotorolaByteOrderpublic long getPosition()
getPosition in class SequentialReaderpublic byte getByte()
throws java.io.IOException
SequentialReadergetByte in class SequentialReaderjava.io.IOExceptionpublic byte[] getBytes(int count)
throws java.io.IOException
SequentialReadergetBytes in class SequentialReadercount - The number of bytes to be returnedjava.io.IOExceptionpublic void getBytes(byte[] buffer,
int offset,
int count)
throws java.io.IOException
SequentialReadergetBytes in class SequentialReaderbuffer - The array to write bytes to.offset - The starting position within buffer to write to.count - The number of bytes to be written.java.io.IOExceptionpublic void skip(long n)
throws java.io.IOException
SequentialReaderEOFException is thrown.skip in class SequentialReadern - the number of byte to skip. Must be zero or greater.java.io.EOFException - the end of the sequence is reached.java.io.IOException - an error occurred reading from the underlying source.public boolean trySkip(long n)
throws java.io.IOException
SequentialReadertrySkip in class SequentialReadern - the number of byte to skip. Must be zero or greater.java.io.IOException - an error occurred reading from the underlying source.public int available()
SequentialReaderSequentialReader without blocking by the next
invocation of a method for this input stream. A single read or skip of
this many bytes will not block, but may read or skip fewer bytes.
Note that while some implementations of SequentialReader like
SequentialByteArrayReader will return the total remaining number
of bytes in the stream, others will not. It is never correct to use the
return value of this method to allocate a buffer intended to hold all
data in this stream.
available in class SequentialReaderSequentialReader without blocking or
0 when it reaches the end of the input stream.private long skipInternal(long n)
throws java.io.IOException
java.io.IOException