ImageInputStream which is able to provide a view of a specific part of the wrapped stream.
Read accesses to the wrapped stream are synchronized, so that users of this stream need to deal with synchronization
against other users of the same instance, but not against other users of the wrapped stream.
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | buffer
A buffer which is used to improve read performance. |
| pack-priv long | bufferBase
Location of the first byte in the buffer with respect to the start of the stream. |
| pack-priv long | bufferTop
Location of the last byte in the buffer with respect to the start of the stream. |
| protected final long | length
The length of the window. |
| protected final long | offset
The position in the wrapped stream at which the window starts. |
| protected final ImageInputStream |
| Access | Constructor and Description |
|---|---|
| public | SubInputStream(ImageInputStream
- The stream to be wrapped. iis, long - The absolute position in the wrapped stream at which the sub-stream starts. offset, long - The length of the sub-stream. length)Construct a new SubInputStream which provides a view of the wrapped stream. |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | Returns: Boolean flag.true if successful, false if not.Fill the buffer at the current stream position. |
| public long | length()
Overrides javax. Implements javax. Returns |
| public int | read()
Implements abstract javax. Implements javax. Reads a single byte from the stream and returns it as an
|
| public int | read(byte[]
an array of bytes to be written to. b, int the starting position within off, int b to write to.the maximum number of bytes to read. len)Implements abstract javax. Implements javax. Reads up to |
| public void |
| buffer | back to summary |
|---|---|
| private final byte[] buffer A buffer which is used to improve read performance. | |
| bufferBase | back to summary |
|---|---|
| pack-priv long bufferBase Location of the first byte in the buffer with respect to the start of the stream. | |
| bufferTop | back to summary |
|---|---|
| pack-priv long bufferTop Location of the last byte in the buffer with respect to the start of the stream. | |
| length | back to summary |
|---|---|
| protected final long length The length of the window. Length is an relative value. | |
| offset | back to summary |
|---|---|
| protected final long offset The position in the wrapped stream at which the window starts. Offset is an absolut value. | |
| wrappedStream | back to summary |
|---|---|
| protected final ImageInputStream wrappedStream | |
| SubInputStream | back to summary |
|---|---|
| public SubInputStream(ImageInputStream iis, long offset, long length) Construct a new SubInputStream which provides a view of the wrapped stream.
| |
| fillBuffer | back to summary |
|---|---|
| private boolean fillBuffer() throws IOException Fill the buffer at the current stream position.
| |
| length | back to summary |
|---|---|
| public long length() Overrides javax. Implements javax. Doc from javax. Returns
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract javax. Implements javax. Doc from javax. Reads a single byte from the stream and returns it as an
Subclasses must provide an implementation for this method. The subclass implementation should update the stream position before exiting. The bit offset within the stream must be reset to zero before the read occurs.
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Implements abstract javax. Implements javax. Doc from javax. Reads up to The bit offset within the stream must be reset to zero before the read occurs. Subclasses must provide an implementation for this method. The subclass implementation should update the stream position before exiting.
| |
| skipBits | back to summary |
|---|---|
| public void skipBits() Skips remaining bits in the current byte. | |