Package com.orsonpdf

Class Stream

Direct Known Subclasses:
GraphicsStream, PDFImage, PDFSoftMaskImage

public abstract class Stream extends PDFObject
A Stream is a PDFObject that has a Dictionary and a byte stream.
  • Field Details

    • filters

      private List<Filter> filters
      Filters (if any) to apply to the stream data.
  • Constructor Details

    • Stream

      Stream(int number)
      Creates a new stream.
      Parameters:
      number - the PDF object number.
  • Method Details

    • addFilter

      public void addFilter(Filter f)
      Adds a filter to the stream.
      Parameters:
      f - the filter (null not permitted).
      See Also:
    • removeFilters

      public void removeFilters()
      Removes any filters that were previously added.
      See Also:
    • getObjectBytes

      public byte[] getObjectBytes() throws IOException
      Returns the PDF bytes for this stream object, with all current filters applied.
      Specified by:
      getObjectBytes in class PDFObject
      Returns:
      The PDF bytes for this stream object.
      Throws:
      IOException - if there is a problem writing to the byte array.
    • createDictionary

      protected Dictionary createDictionary(int streamLength)
      Creates the dictionary for this stream object. The dictionary will be populated with the stream length and the decode values for any filters that are currently applied.
      Parameters:
      streamLength - the stream length.
      Returns:
      The dictionary.
    • getRawStreamData

      public abstract byte[] getRawStreamData()
      Returns the raw data for the stream.
      Returns:
      The raw data for the stream.