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
public class FlateDecodeFilter extends MemoryLimitsAwareFilter
Handles FlateDecode filter.
-
-
Constructor Summary
Constructors Constructor Description FlateDecodeFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
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, java.io.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
-
-
-
-
Method Detail
-
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
public static byte[] decodePredictor(byte[] in, PdfObject decodeParams)
- 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
protected static byte[] flateDecodeInternal(byte[] in, boolean strict, java.io.ByteArrayOutputStream out)
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
private static int getNumberOrDefault(PdfDictionary dict, PdfName key, int defaultInt)
-
-