Package org.apache.pdfbox.filter
Class CCITTFaxDecoderStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.pdfbox.filter.CCITTFaxDecoderStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
CCITT Modified Huffman RLE, Group 3 (T4) and Group 4 (T6) fax compression.
- Version:
- $Id: CCITTFaxDecoderStream.java,v 1.0 23.05.12 15:55 haraldk Exp$ Taken from commit 24c6682236e5a02151359486aa4075ddc5ab1534 of 18.08.2018 from twelvemonkeys/imageio/plugins/tiff/CCITTFaxDecoderStream.java Initial changes for PDFBox, discussed in PDFBOX-3338: - removed Validate() usages - catch VALUE_EOL in decode1D()
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final short[][]
(package private) static final short[][]
(package private) static final CCITTFaxDecoderStream.Tree
(package private) int
(package private) int
private int[]
private int
private int[]
private int
(package private) static final CCITTFaxDecoderStream.Tree
private final int
private int
private int
private final byte[]
(package private) static final CCITTFaxDecoderStream.Node
(package private) static final CCITTFaxDecoderStream.Tree
(package private) static final CCITTFaxDecoderStream.Node
private int
private final boolean
private final boolean
private final boolean
private final boolean
private final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
static final short[][]
static final short[][]
(package private) static final CCITTFaxDecoderStream.Tree
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
ConstructorsConstructorDescriptionCCITTFaxDecoderStream
(InputStream stream, int columns, int type, long options, boolean byteAligned) Creates a CCITTFaxDecoderStream. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
decode1D()
private void
decode2D()
private void
private void
private void
private void
private int
private void
fetch()
private int
getNextChangingElement
(int a0, boolean white) boolean
int
read()
int
read
(byte[] b, int off, int len) private boolean
readBit()
void
reset()
private void
long
skip
(long n) Methods inherited from class java.io.FilterInputStream
available, close, mark, read
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
columns
private final int columns -
decodedRow
private final byte[] decodedRow -
optionG32D
private final boolean optionG32D -
optionG3Fill
private final boolean optionG3Fill -
optionUncompressed
private final boolean optionUncompressed -
optionByteAligned
private final boolean optionByteAligned -
type
private final int type -
decodedLength
private int decodedLength -
decodedPos
private int decodedPos -
changesReferenceRow
private int[] changesReferenceRow -
changesCurrentRow
private int[] changesCurrentRow -
changesReferenceRowCount
private int changesReferenceRowCount -
changesCurrentRowCount
private int changesCurrentRowCount -
lastChangingElement
private int lastChangingElement -
buffer
int buffer -
bufferPos
int bufferPos -
BLACK_CODES
static final short[][] BLACK_CODES -
BLACK_RUN_LENGTHS
static final short[][] BLACK_RUN_LENGTHS -
WHITE_CODES
public static final short[][] WHITE_CODES -
WHITE_RUN_LENGTHS
public static final short[][] WHITE_RUN_LENGTHS -
EOL
-
FILL
-
blackRunTree
-
whiteRunTree
-
eolOnlyTree
-
codeTree
-
VALUE_EOL
static final int VALUE_EOL- See Also:
-
VALUE_FILL
static final int VALUE_FILL- See Also:
-
VALUE_PASSMODE
static final int VALUE_PASSMODE- See Also:
-
VALUE_HMODE
static final int VALUE_HMODE- See Also:
-
-
Constructor Details
-
CCITTFaxDecoderStream
public CCITTFaxDecoderStream(InputStream stream, int columns, int type, long options, boolean byteAligned) Creates a CCITTFaxDecoderStream. This constructor may be used for CCITT streams embedded in PDF files, which use EncodedByteAlign.- Parameters:
stream
- the compressed CCITT stream.columns
- the number of columns in the stream.type
- the type of stream, must be one ofCOMPRESSION_CCITT_MODIFIED_HUFFMAN_RLE
,COMPRESSION_CCITT_T4
orCOMPRESSION_CCITT_T6
.options
- CCITT T.4 or T.6 options.byteAligned
- enable byte alignment used in PDF files (EncodedByteAlign).
-
-
Method Details
-
fetch
- Throws:
IOException
-
decode1D
- Throws:
IOException
-
decode2D
- Throws:
IOException
-
getNextChangingElement
private int getNextChangingElement(int a0, boolean white) -
decodeRowType2
- Throws:
IOException
-
decodeRowType4
- Throws:
IOException
-
decodeRowType6
- Throws:
IOException
-
decodeRow
- Throws:
IOException
-
decodeRun
- Throws:
IOException
-
resetBuffer
private void resetBuffer() -
readBit
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classFilterInputStream
-
reset
- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-