public static class Bitstream.ByteArrayStream extends Object implements Bitstream.ByteStream<byte[]>
byte stream
.
Constructor and Description |
---|
Bitstream.ByteArrayStream(byte[] 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. |
byte[] |
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(byte[] 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 void setStream(byte[] stream)
Bitstream.ByteStream
Bitstream.ByteStream.close()
ing the previous one.setStream
in interface Bitstream.ByteStream<byte[]>
public byte[] getStream()
Bitstream.ByteStream
getStream
in interface Bitstream.ByteStream<byte[]>
public void close()
Bitstream.ByteStream
Bitstream.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<byte[]>
public void flush()
Bitstream.ByteStream
output stream
operations, or do nothing.flush
in interface Bitstream.ByteStream<byte[]>
public boolean canInput()
Bitstream.ByteStream
Bitstream.ByteStream.read()
.canInput
in interface Bitstream.ByteStream<byte[]>
public boolean canOutput()
Bitstream.ByteStream
Bitstream.ByteStream.write(byte)
canOutput
in interface Bitstream.ByteStream<byte[]>
public long position()
Bitstream.ByteStream
position
in interface Bitstream.ByteStream<byte[]>
public long skip(long n)
Bitstream.ByteStream
skip
in interface Bitstream.ByteStream<byte[]>
n
- number of bytes to skippublic void mark(int readLimit)
Bitstream.ByteStream
Bitstream.ByteStream.reset()
.mark
in interface Bitstream.ByteStream<byte[]>
public void reset() throws IllegalStateException
Bitstream.ByteStream
Bitstream.ByteStream.mark(int)
.
markpos is kept, hence Bitstream.ByteStream.reset()
can be called multiple times.
reset
in interface Bitstream.ByteStream<byte[]>
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<byte[]>
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<byte[]>