Package com.itextpdf.kernel.pdf.filters
Class FlateDecodeFilter
java.lang.Object
com.itextpdf.kernel.pdf.MemoryLimitsAwareFilter
com.itextpdf.kernel.pdf.filters.FlateDecodeFilter
- All Implemented Interfaces:
IFilterHandler
- Direct Known Subclasses:
FlateDecodeStrictFilter
Handles FlateDecode filter.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
decode
(byte[] b, PdfName filterName, PdfObject decodeParams, PdfDictionary streamDictionary) Decode the byte[] using the provided filterName.static byte[]
decodePredictor
(byte[] in, PdfObject decodeParams) static byte[]
flateDecode
(byte[] in, boolean strict) A helper to flateDecode.protected static byte[]
flateDecodeInternal
(byte[] in, boolean strict, ByteArrayOutputStream out) A helper to flateDecode.private static int
getNumberOrDefault
(PdfDictionary dict, PdfName key, int defaultInt) Methods inherited from class com.itextpdf.kernel.pdf.MemoryLimitsAwareFilter
enableMemoryLimitsAwareHandler
-
Constructor Details
-
FlateDecodeFilter
public FlateDecodeFilter()
-
-
Method Details
-
flateDecode
public static byte[] flateDecode(byte[] in, boolean strict) A helper to flateDecode.- Parameters:
in
- the input datastrict
-true
to read a correct stream.false
to try to read a corrupted stream.- Returns:
- the decoded data
-
decodePredictor
- Parameters:
in
- Input byte array.decodeParams
- PdfDictionary of decodeParams.- Returns:
- a byte array
-
decode
public byte[] decode(byte[] b, PdfName filterName, PdfObject decodeParams, PdfDictionary streamDictionary) Decode the byte[] using the provided filterName.- Parameters:
b
- the bytes that need to be decodedfilterName
- PdfName of the filterdecodeParams
- decode parametersstreamDictionary
- the dictionary of the stream. Can contain additional information needed to decode the byte[].- Returns:
- decoded byte array
-
flateDecodeInternal
A helper to flateDecode.- Parameters:
in
- the input datastrict
-true
to read a correct stream.false
to try to read a corrupted stream.out
- the out stream which will be used to write the bytes.- Returns:
- the decoded data
-
getNumberOrDefault
-