Class SubInputStream
java.lang.Object
javax.imageio.stream.ImageInputStreamImpl
org.apache.pdfbox.jbig2.io.SubInputStream
- All Implemented Interfaces:
Closeable, DataInput, AutoCloseable, ImageInputStream
A wrapper for an
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.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final longThe length of the window.protected final longThe position in the wrapped stream at which the window starts.protected final ImageInputStreamFields inherited from class ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos -
Constructor Summary
ConstructorsConstructorDescriptionSubInputStream(ImageInputStream iis, long offset, long length) Construct a new SubInputStream which provides a view of the wrapped stream. -
Method Summary
Methods inherited from class ImageInputStreamImpl
checkClosed, close, finalize, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, seek, setBitOffset, setByteOrder, skipBytes, skipBytes
-
Field Details
-
wrappedStream
-
offset
protected final long offsetThe position in the wrapped stream at which the window starts. Offset is an absolut value. -
length
protected final long lengthThe length of the window. Length is an relative value.
-
-
Constructor Details
-
SubInputStream
Construct a new SubInputStream which provides a view of the wrapped stream.- Parameters:
iis- - The stream to be wrapped.offset- - The absolute position in the wrapped stream at which the sub-stream starts.length- - The length of the sub-stream.
-
-
Method Details
-
read
- Specified by:
readin interfaceImageInputStream- Specified by:
readin classImageInputStreamImpl- Throws:
IOException
-
read
- Specified by:
readin interfaceImageInputStream- Specified by:
readin classImageInputStreamImpl- Throws:
IOException
-
length
public long length()- Specified by:
lengthin interfaceImageInputStream- Overrides:
lengthin classImageInputStreamImpl
-
skipBits
public void skipBits()Skips remaining bits in the current byte.
-