public static class Bitstream.ByteBufferStream extends Object implements Bitstream.ByteStream<ByteBuffer>
byte stream.
| Constructor and Description |
|---|
Bitstream.ByteBufferStream(ByteBuffer stream) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canInput()
Return true if stream can handle input, i.e.
|
boolean |
canOutput()
Return true if stream can handle output, i.e.
|
void |
close()
Closing the underlying stream, implies
Bitstream.ByteStream.flush(). |
void |
flush()
Synchronizes all underlying
output stream operations, or do nothing. |
ByteBuffer |
getStream()
Returns the underlying stream
|
void |
mark(int readLimit)
Set markpos to current position, allowing the stream to be
Bitstream.ByteStream.reset(). |
long |
position()
Returns the byte position in the stream.
|
int |
read()
Reads one byte from the stream.
|
void |
reset()
Reset stream position to markpos as set via
Bitstream.ByteStream.mark(int). |
void |
setStream(ByteBuffer stream)
Sets the underlying stream, without
Bitstream.ByteStream.close()ing the previous one. |
long |
skip(long n)
It is implementation dependent, whether backward skip giving a negative number is supported or not.
|
int |
write(byte val)
Writes one byte, to the stream.
|
public Bitstream.ByteBufferStream(ByteBuffer stream)
public void setStream(ByteBuffer stream)
Bitstream.ByteStreamBitstream.ByteStream.close()ing the previous one.setStream in interface Bitstream.ByteStream<ByteBuffer>public ByteBuffer getStream()
Bitstream.ByteStreamgetStream in interface Bitstream.ByteStream<ByteBuffer>public void close()
Bitstream.ByteStreamBitstream.ByteStream.flush().
Implementation will null the stream references,
hence Bitstream.ByteStream.setStream(Object) must be called before re-using instance.
close in interface Bitstream.ByteStream<ByteBuffer>public void flush()
Bitstream.ByteStreamoutput stream operations, or do nothing.flush in interface Bitstream.ByteStream<ByteBuffer>public boolean canInput()
Bitstream.ByteStreamBitstream.ByteStream.read().canInput in interface Bitstream.ByteStream<ByteBuffer>public boolean canOutput()
Bitstream.ByteStreamBitstream.ByteStream.write(byte)canOutput in interface Bitstream.ByteStream<ByteBuffer>public long position()
Bitstream.ByteStreamposition in interface Bitstream.ByteStream<ByteBuffer>public long skip(long n)
Bitstream.ByteStreamskip in interface Bitstream.ByteStream<ByteBuffer>n - number of bytes to skippublic void mark(int readLimit)
Bitstream.ByteStreamBitstream.ByteStream.reset().mark in interface Bitstream.ByteStream<ByteBuffer>public void reset()
throws IllegalStateException
Bitstream.ByteStreamBitstream.ByteStream.mark(int).
markpos is kept, hence Bitstream.ByteStream.reset() can be called multiple times.
reset in interface Bitstream.ByteStream<ByteBuffer>IllegalStateException - if markpos has not been set via Bitstream.ByteStream.mark(int) or reset operation failed.public int read()
Bitstream.ByteStream
Returns Bitstream.EOS is end-of-stream is reached,
otherwise the resulting value.
read in interface Bitstream.ByteStream<ByteBuffer>public int write(byte val)
Bitstream.ByteStream
Returns Bitstream.EOS is end-of-stream is reached,
otherwise the written value.
write in interface Bitstream.ByteStream<ByteBuffer>