Class PDFDecoder

java.lang.Object
org.loboevolution.pdfview.decode.PDFDecoder

public class PDFDecoder extends Object
A PDF Decoder encapsulates all the methods of decoding a stream of bytes based on all the various encoding methods.

You should use the decodeStream() method of this object rather than using any of the decoders directly.

  • Field Details

    • DCT_FILTERS

      public static final Set<String> DCT_FILTERS
      Constant DCT_FILTERS
  • Method Details

    • isLastFilter

      public static boolean isLastFilter(PDFObject dict, Set<String> filters) throws IOException

      isLastFilter.

      Parameters:
      dict - a PDFObject object.
      filters - a Set object.
      Returns:
      a boolean.
      Throws:
      IOException - if any.
    • decodeStream

      public static ByteBuffer decodeStream(PDFObject dict, ByteBuffer streamBuf, Set<String> filterLimits) throws IOException
      decode a byte[] stream using the filters specified in the object's dictionary (passed as argument 1).
      Parameters:
      dict - the dictionary associated with the stream
      streamBuf - the data in the stream, as a byte buffer
      filterLimits - a Set object.
      Returns:
      a ByteBuffer object.
      Throws:
      IOException - if any.
    • isEncrypted

      public static boolean isEncrypted(PDFObject dict) throws IOException
      Determines whether a stream is encrypted or not; note that encodings (e.g., Flate, LZW) are not considered encryptions.
      Parameters:
      dict - the stream dictionary
      Returns:
      whether the stream is encrypted
      Throws:
      IOException - if any.