Class SubInputStream

java.lang.Object
javax.imageio.stream.ImageInputStreamImpl
org.apache.pdfbox.jbig2.io.SubInputStream
All Implemented Interfaces:
Closeable, DataInput, AutoCloseable, ImageInputStream

public class SubInputStream extends ImageInputStreamImpl
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 Details

    • wrappedStream

      protected final ImageInputStream wrappedStream
    • offset

      protected final long offset
      The position in the wrapped stream at which the window starts. Offset is an absolut value.
    • length

      protected final long length
      The length of the window. Length is an relative value.
    • buffer

      private final byte[] buffer
      A buffer which is used to improve read performance.
    • bufferBase

      long bufferBase
      Location of the first byte in the buffer with respect to the start of the stream.
    • bufferTop

      long bufferTop
      Location of the last byte in the buffer with respect to the start of the stream.
  • Constructor Details

    • SubInputStream

      public SubInputStream(ImageInputStream iis, long offset, long length)
      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