General byte stream.
More...
|
| void | setStream (final T stream) |
| | Sets the underlying stream, without close()ing the previous one. More...
|
| |
| T | getStream () |
| | Returns the underlying stream. More...
|
| |
| void | close () throws IOException |
| | Closing the underlying stream, implies flush(). More...
|
| |
| void | flush () throws IOException |
| | Synchronizes all underlying output stream operations, or do nothing. More...
|
| |
| boolean | canInput () |
| | Return true if stream can handle input, i.e. More...
|
| |
| boolean | canOutput () |
| | Return true if stream can handle output, i.e. More...
|
| |
| long | position () |
| | Returns the byte position in the stream. More...
|
| |
| long | position (long newPosition) throws UnsupportedOperationException, IllegalArgumentException |
| | Sets this stream's position. More...
|
| |
| long | skip (final long n) throws IOException |
| | It is implementation dependent, whether backward skip giving a negative number is supported or not. More...
|
| |
| void | mark (final int readLimit) throws UnsupportedOperationException |
| | Set markpos to current position, allowing the stream to be reset(). More...
|
| |
| void | reset () throws UnsupportedOperationException, IllegalStateException, IOException |
| | Reset stream position to markpos as set via mark(int). More...
|
| |
| int | read () throws UnsupportedOperationException, IOException |
| | Reads one byte from the stream. More...
|
| |
| int | write (final byte val) throws UnsupportedOperationException, IOException |
| | Writes one byte, to the stream. More...
|
| |
General byte stream.
Definition at line 60 of file Bitstream.java.
◆ canInput()
Return true if stream can handle input, i.e.
read().
◆ canOutput()
Return true if stream can handle output, i.e.
write(byte)
◆ close()
Closing the underlying stream, implies flush().
Implementation will null the stream references, hence setStream(Object) must be called before re-using instance.
- Exceptions
-
◆ flush()
Synchronizes all underlying output stream operations, or do nothing.
- Exceptions
-
◆ getStream()
Returns the underlying stream.
◆ mark()
Set markpos to current position, allowing the stream to be reset().
- Parameters
-
| readlimit | maximum number of bytes able to read before invalidating the markpos. |
- Exceptions
-
| UnsupportedOperationException | if not supported, i.e. if stream is not an input stream. |
◆ position() [1/2]
Returns the byte position in the stream.
◆ position() [2/2]
Sets this stream's position.
A set mark is cleared if > new position.
Returns Bitstream#EOS is end-of-stream is reached, otherwise the new position.
Known supporting implementation is ByteBufferStream and ByteArrayStream.
- Parameters
-
| newPosition | The new positive position. |
- Returns
- The new set position or
Bitstream#EOS if end-of-stream is reached.
- Exceptions
-
◆ read()
Reads one byte from the stream.
Returns Bitstream#EOS is end-of-stream is reached, otherwise the resulting value.
- Exceptions
-
| IOException | |
| UnsupportedOperationException | if not supported, i.e. if stream is not an input stream. |
◆ reset()
Reset stream position to markpos as set via mark(int).
markpos is kept, hence reset() can be called multiple times.
- Exceptions
-
| UnsupportedOperationException | if not supported, i.e. if stream is not an input stream. |
| IllegalStateException | if markpos has not been set via mark(int) or reset operation failed. |
| IOException | if reset operation failed. |
◆ setStream()
Sets the underlying stream, without close()ing the previous one.
◆ skip()
It is implementation dependent, whether backward skip giving a negative number is supported or not.
- Parameters
-
- Returns
- actual skipped bytes
- Exceptions
-
◆ write()
Writes one byte, to the stream.
Returns Bitstream#EOS is end-of-stream is reached, otherwise the written value.
- Exceptions
-
| IOException | |
| UnsupportedOperationException | if not supported, i.e. if stream is not an output stream. |
The documentation for this interface was generated from the following file: