Package org.apache.pdfbox.filter
Class Predictor
java.lang.Object
org.apache.pdfbox.filter.Predictor
Helper class to contain predictor decoding used by Flate and LZW filter.
To see the history, look at the FlateFilter class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classOutput stream that implements predictor decoding. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static intcalcSetBitSeq(int by, int startBit, int bitSize, int val) (package private) static intcalculateRowLength(int colors, int bitsPerComponent, int columns) (package private) static voiddecodePredictorRow(int predictor, int colors, int bitsPerComponent, int columns, byte[] actline, byte[] lastline) Decodes a single line of data in-place.(package private) static intgetBitSeq(int by, int startBit, int bitSize) (package private) static OutputStreamwrapPredictor(OutputStream out, COSDictionary decodeParams) Wraps andOutputStreamin a predictor decoding stream as necessary.
-
Constructor Details
-
Predictor
private Predictor()
-
-
Method Details
-
decodePredictorRow
static void decodePredictorRow(int predictor, int colors, int bitsPerComponent, int columns, byte[] actline, byte[] lastline) Decodes a single line of data in-place.- Parameters:
predictor- Predictor value for the current linecolors- Number of color components, from decode parameters.bitsPerComponent- Number of bits per components, from decode parameters.columns- Number samples in a row, from decode parameters.actline- Current (active) line to decode. Data will be decoded in-place, i.e. - the contents of this buffer will be modified.lastline- The previous decoded line. When decoding the first line, this parameter should be an empty byte array of the same length asactline.
-
calculateRowLength
static int calculateRowLength(int colors, int bitsPerComponent, int columns) -
getBitSeq
static int getBitSeq(int by, int startBit, int bitSize) -
calcSetBitSeq
static int calcSetBitSeq(int by, int startBit, int bitSize, int val) -
wrapPredictor
Wraps andOutputStreamin a predictor decoding stream as necessary. If no predictor is specified by the parameters, the original stream is returned as is.- Parameters:
out- The stream to which decoded data should be writtendecodeParams- Decode parameters for the stream- Returns:
- An
OutputStreamis returned, which will write decoded data into the given stream. If no predictor is specified, the original stream is returned.
-