Package org.apache.pdfbox.filter
Class Filter
- java.lang.Object
-
- org.apache.pdfbox.filter.Filter
-
- Direct Known Subclasses:
ASCII85Filter,ASCIIHexFilter,CCITTFaxFilter,CryptFilter,DCTFilter,FlateFilter,IdentityFilter,JBIG2Filter,JPXFilter,LZWFilter,RunLengthDecodeFilter
public abstract class Filter extends java.lang.ObjectA filter for stream data.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.LogLOGstatic java.lang.StringSYSPROP_DEFLATELEVELCompression Level System Property.
-
Constructor Summary
Constructors Modifier Constructor Description protectedFilter()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract DecodeResultdecode(java.io.InputStream encoded, java.io.OutputStream decoded, COSDictionary parameters, int index)Decodes data, producing the original non-encoded data.DecodeResultdecode(java.io.InputStream encoded, java.io.OutputStream decoded, COSDictionary parameters, int index, DecodeOptions options)Decodes data, with optional DecodeOptions.static RandomAccessReaddecode(java.io.InputStream encoded, java.util.List<Filter> filterList, COSDictionary parameters, DecodeOptions options, java.util.List<DecodeResult> results)Decodes data, with optional DecodeOptions.protected abstract voidencode(java.io.InputStream input, java.io.OutputStream encoded, COSDictionary parameters)voidencode(java.io.InputStream input, java.io.OutputStream encoded, COSDictionary parameters, int index)Encodes data.static javax.imageio.ImageReaderfindImageReader(java.lang.String formatName, java.lang.String errorCause)Finds a suitable image reader for an image format.static javax.imageio.ImageReaderfindRasterReader(java.lang.String formatName, java.lang.String errorCause)Finds a suitable image raster reader for an image format.static intgetCompressionLevel()protected COSDictionarygetDecodeParams(COSDictionary dictionary, int index)
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
SYSPROP_DEFLATELEVEL
public static final java.lang.String SYSPROP_DEFLATELEVEL
Compression Level System Property. Set this to a value from 0 to 9 to change the zlib deflate compression level used to compress /Flate streams. The default value is -1 which isDeflater.DEFAULT_COMPRESSION. To set maximum compression, useSystem.setProperty(Filter.SYSPROP_DEFLATELEVEL, "9");- See Also:
- Constant Field Values
-
-
Method Detail
-
decode
public abstract DecodeResult decode(java.io.InputStream encoded, java.io.OutputStream decoded, COSDictionary parameters, int index) throws java.io.IOException
Decodes data, producing the original non-encoded data.- Parameters:
encoded- the encoded byte streamdecoded- the stream where decoded data will be writtenparameters- the parameters used for decodingindex- the index to the filter being decoded- Returns:
- repaired parameters dictionary, or the original parameters dictionary
- Throws:
java.io.IOException- if the stream cannot be decoded
-
decode
public DecodeResult decode(java.io.InputStream encoded, java.io.OutputStream decoded, COSDictionary parameters, int index, DecodeOptions options) throws java.io.IOException
Decodes data, with optional DecodeOptions. Not all filters support all options, and so callers should check the options'honoredflag to test if they were applied.- Parameters:
encoded- the encoded byte streamdecoded- the stream where decoded data will be writtenparameters- the parameters used for decodingindex- the index to the filter being decodedoptions- additional options for decoding- Returns:
- repaired parameters dictionary, or the original parameters dictionary
- Throws:
java.io.IOException- if the stream cannot be decoded
-
encode
public final void encode(java.io.InputStream input, java.io.OutputStream encoded, COSDictionary parameters, int index) throws java.io.IOExceptionEncodes data.- Parameters:
input- the byte stream to encodeencoded- the stream where encoded data will be writtenparameters- the parameters used for encodingindex- the index to the filter being encoded- Throws:
java.io.IOException- if the stream cannot be encoded
-
encode
protected abstract void encode(java.io.InputStream input, java.io.OutputStream encoded, COSDictionary parameters) throws java.io.IOException- Throws:
java.io.IOException
-
getDecodeParams
protected COSDictionary getDecodeParams(COSDictionary dictionary, int index)
-
findImageReader
public static final javax.imageio.ImageReader findImageReader(java.lang.String formatName, java.lang.String errorCause) throws MissingImageReaderExceptionFinds a suitable image reader for an image format.- Parameters:
formatName- The image format to search for.errorCause- The probably cause if something goes wrong.- Returns:
- The image reader for the format.
- Throws:
MissingImageReaderException- if no image reader is found.
-
findRasterReader
public static final javax.imageio.ImageReader findRasterReader(java.lang.String formatName, java.lang.String errorCause) throws MissingImageReaderExceptionFinds a suitable image raster reader for an image format.- Parameters:
formatName- The image format to search for.errorCause- The probably cause if something goes wrong.- Returns:
- The image reader for the format.
- Throws:
MissingImageReaderException- if no image reader is found.
-
getCompressionLevel
public static int getCompressionLevel()
- Returns:
- the ZIP compression level configured for PDFBox
-
decode
public static RandomAccessRead decode(java.io.InputStream encoded, java.util.List<Filter> filterList, COSDictionary parameters, DecodeOptions options, java.util.List<DecodeResult> results) throws java.io.IOException
Decodes data, with optional DecodeOptions. Not all filters support all options, and so callers should check the options'honoredflag to test if they were applied.- Parameters:
encoded- the input stream holding the encoded datafilterList- list of filters to be used for decodingparameters- the parameters used for decodingoptions- additional options for decodingresults- list of optional decoding results for each filter- Returns:
- the decoded stream data
- Throws:
java.io.IOException- if the stream cannot be decodedjava.lang.IllegalArgumentException- if filterList is empty
-
-