public final class PositionalBufferedStream extends InputStream implements Positional
InputStream
which performs it's own buffering, and keeps track of the position.Constructor and Description |
---|
PositionalBufferedStream(InputStream is) |
PositionalBufferedStream(InputStream is,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getPosition()
The current offset, in bytes, of this stream/writer/file.
|
boolean |
isDone()
Is the stream done? Equivalent to ! hasNext() for an iterator?
|
static void |
main(String[] args) |
int |
peek()
Return the next byte in the first, without actually reading it from the stream.
|
int |
read() |
int |
read(byte[] bytes) |
int |
read(byte[] bytes,
int start,
int len) |
long |
skip(long nBytes)
Skip the next nBytes in the stream.
|
available, mark, markSupported, reset
public PositionalBufferedStream(InputStream is)
public PositionalBufferedStream(InputStream is, int bufferSize)
public final long getPosition()
LocationAware
getPosition
in interface LocationAware
public final int read() throws IOException
read
in class InputStream
IOException
public final int read(byte[] bytes, int start, int len) throws IOException
read
in class InputStream
IOException
public final int read(byte[] bytes) throws IOException
read
in class InputStream
IOException
public final boolean isDone() throws IOException
Positional
isDone
in interface Positional
IOException
public final int peek() throws IOException
Positional
peek
in interface Positional
IOException
public final long skip(long nBytes) throws IOException
Positional
skip
in interface Positional
skip
in class InputStream
nBytes
- to skip, must be >= 0IOException
public final void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream