com.etymon.pjx.stream
Class PdfDecodeStream

java.lang.Object
  extended by com.etymon.pjx.stream.PdfDecodeStream

public class PdfDecodeStream
extends java.lang.Object

Performs pipelined stream filtering to attempt to decode a stream. This class is synchronized.


Field Summary
protected  PdfFlateFilter _flateFilter
          A flate filter instance to use for decoding.
protected  PdfManager _m
          The manager associated with the PDF document.
protected static PdfName PDFNAME_FILTER
           
protected static PdfName PDFNAME_FLATEDECODE
           
 
Constructor Summary
PdfDecodeStream(PdfManager manager)
          Constructs an instance of this class with a specified manager.
 
Method Summary
 PdfStream decode(PdfStream stream)
          Applies a sequence of stream filter decoders to the specified stream, based on the stream dictionary's Filter entry, in order to decode the stream.
protected static java.util.List getFilterList(PdfManager manager, java.util.Map streamDict)
          Extracts the filter list from a stream dictionary map.
protected static void modifyFilterList(java.util.List filters, java.util.Map streamDict)
          Removes the first element of a filter list, adds the filter list to a stream dictionary map, and returns the resultant stream dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PDFNAME_FILTER

protected static final PdfName PDFNAME_FILTER

PDFNAME_FLATEDECODE

protected static final PdfName PDFNAME_FLATEDECODE

_m

protected PdfManager _m
The manager associated with the PDF document.


_flateFilter

protected PdfFlateFilter _flateFilter
A flate filter instance to use for decoding.

Constructor Detail

PdfDecodeStream

public PdfDecodeStream(PdfManager manager)
Constructs an instance of this class with a specified manager.

Parameters:
manager - the manager instance.
Method Detail

decode

public PdfStream decode(PdfStream stream)
                 throws java.io.IOException,
                        PdfFormatException,
                        PdfDecoderException
Applies a sequence of stream filter decoders to the specified stream, based on the stream dictionary's Filter entry, in order to decode the stream. If the stream is encoded with an unsupported filter, this method will throw PdfDecoderNotSupportedException to indicate that it is unable to decode the stream. If the stream is not encoded with any filters, this method returns the original stream unmodified.

Parameters:
stream - the stream to decode.
Returns:
the decoded stream, or the original stream if it is not encoded with any filters.
Throws:
java.io.IOException
PdfFormatException
PdfDecoderException

modifyFilterList

protected static void modifyFilterList(java.util.List filters,
                                       java.util.Map streamDict)
                                throws PdfFormatException
Removes the first element of a filter list, adds the filter list to a stream dictionary map, and returns the resultant stream dictionary.

Parameters:
filters - the filter list.
streamDict - the stream dictionary map.
Throws:
PdfFormatException

getFilterList

protected static java.util.List getFilterList(PdfManager manager,
                                              java.util.Map streamDict)
                                       throws java.io.IOException,
                                              PdfFormatException
Extracts the filter list from a stream dictionary map.

Parameters:
manager - the manager to use for indirect reference look-ups.
streamDict - the stream dictionary map.
Returns:
the filter list.
Throws:
PdfFormatException
java.io.IOException