Class PDFStream

java.lang.Object
com.inductiveautomation.rm.pdf.reader.PDFStream
All Implemented Interfaces:
Cloneable

public class PDFStream extends Object implements Cloneable
This class represents a PDF stream object.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PDFStream(byte[] bytes, int offset, int len, Map aMap)
    Creates a new stream by copying the byte array and map.
    PDFStream(byte[] bytes, Map aMap)
    Creates a new stream from the byte array and map.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The dict for a stream may specify multiple filters.
    Standard clone implementation.
    createCCITTFaxDecoder(Map params, byte[] bytes, int offset, int len)
    Utility method to create a CCITTFaxDecoder from the stream's decodeParameters dictionary.
    byte[]
    Returns the result of running the data through all the filters.
    byte[]
    decodeStream(int nfilters)
    Returns the result of running the data through the first n filters.
    byte[]
    Returns the stream bytes.
    static byte[]
    getBytesDecoded(byte[] bytes, int offset, int length, String aFilter, Map params)
    Returns the result of runnning the bytes through a particular filter (/FlateDecode, /LZW, /ASCII85Decode, etc.).
    Returns the stream dictionary.
    Returns the filter parameters for a particular filter
    int
    Returns the index of a particular filter in the filter chain, or -1 if not found.
    int
    Returns the total number of filters with which this stream is currently encoded.
    boolean
    Tests whether a specific filter will be needed to decode the stream.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PDFStream

      public PDFStream(byte[] bytes, Map aMap)
      Creates a new stream from the byte array and map.
    • PDFStream

      public PDFStream(byte[] bytes, int offset, int len, Map aMap)
      Creates a new stream by copying the byte array and map.
  • Method Details

    • getBytes

      public byte[] getBytes()
      Returns the stream bytes.
    • getDictionary

      public Map getDictionary()
      Returns the stream dictionary.
    • addFilter

      public void addFilter(String aName)
      The dict for a stream may specify multiple filters. The "Filter" property is either a single filter name or an array of filter names. If it's an array, the PDF reader will apply the filters in the order they appear. Call this method with the name of the filter after applying the encoding to the data.
    • usesFilter

      public boolean usesFilter(String fName)
      Tests whether a specific filter will be needed to decode the stream.
    • indexOfFilter

      public int indexOfFilter(String fName)
      Returns the index of a particular filter in the filter chain, or -1 if not found.
    • numFilters

      public int numFilters()
      Returns the total number of filters with which this stream is currently encoded.
    • getFilterParameters

      public Map getFilterParameters(String name)
      Returns the filter parameters for a particular filter
    • decodeStream

      public byte[] decodeStream()
      Returns the result of running the data through all the filters.
    • decodeStream

      public byte[] decodeStream(int nfilters)
      Returns the result of running the data through the first n filters.
    • getBytesDecoded

      public static byte[] getBytesDecoded(byte[] bytes, int offset, int length, String aFilter, Map params)
      Returns the result of runnning the bytes through a particular filter (/FlateDecode, /LZW, /ASCII85Decode, etc.).
    • clone

      public Object clone()
      Standard clone implementation.
      Overrides:
      clone in class Object
    • createCCITTFaxDecoder

      public static RBCodecCCITTFaxDecode createCCITTFaxDecoder(Map params, byte[] bytes, int offset, int len)
      Utility method to create a CCITTFaxDecoder from the stream's decodeParameters dictionary.