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, resetpublic PositionalBufferedStream(InputStream is)
public PositionalBufferedStream(InputStream is, int bufferSize)
public final long getPosition()
LocationAwaregetPosition in interface LocationAwarepublic final int read()
throws IOException
read in class InputStreamIOExceptionpublic final int read(byte[] bytes,
int start,
int len)
throws IOException
read in class InputStreamIOExceptionpublic final int read(byte[] bytes)
throws IOException
read in class InputStreamIOExceptionpublic final boolean isDone()
throws IOException
PositionalisDone in interface PositionalIOExceptionpublic final int peek()
throws IOException
Positionalpeek in interface PositionalIOExceptionpublic final long skip(long nBytes)
throws IOException
Positionalskip in interface Positionalskip in class InputStreamnBytes - to skip, must be >= 0IOExceptionpublic final void close()
close in interface Closeableclose in interface AutoCloseableclose in class InputStream