Package org.apache.pdfbox.filter
Class CCITTFaxDecoderStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.pdfbox.filter.CCITTFaxDecoderStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
final class CCITTFaxDecoderStream extends java.io.FilterInputStreamCCITT 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 Classes Modifier and Type Class Description private static classCCITTFaxDecoderStream.Nodeprivate static classCCITTFaxDecoderStream.Tree
-
Field Summary
Fields Modifier and Type Field Description (package private) static short[][]BLACK_CODES(package private) static short[][]BLACK_RUN_LENGTHS(package private) static CCITTFaxDecoderStream.TreeblackRunTree(package private) intbuffer(package private) intbufferPosprivate int[]changesCurrentRowprivate intchangesCurrentRowCountprivate int[]changesReferenceRowprivate intchangesReferenceRowCount(package private) static CCITTFaxDecoderStream.TreecodeTreeprivate intcolumnsprivate intdecodedLengthprivate intdecodedPosprivate byte[]decodedRow(package private) static CCITTFaxDecoderStream.NodeEOL(package private) static CCITTFaxDecoderStream.TreeeolOnlyTree(package private) static CCITTFaxDecoderStream.NodeFILLprivate intlastChangingElementprivate booleanoptionByteAlignedprivate booleanoptionG32Dprivate booleanoptionG3Fillprivate booleanoptionUncompressedprivate inttype(package private) static intVALUE_EOL(package private) static intVALUE_FILL(package private) static intVALUE_HMODE(package private) static intVALUE_PASSMODEstatic short[][]WHITE_CODESstatic short[][]WHITE_RUN_LENGTHS(package private) static CCITTFaxDecoderStream.TreewhiteRunTree
-
Constructor Summary
Constructors Constructor Description CCITTFaxDecoderStream(java.io.InputStream stream, int columns, int type, long options, boolean byteAligned)Creates a CCITTFaxDecoderStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voiddecode1D()private voiddecode2D()private voiddecodeRow()private voiddecodeRowType2()private voiddecodeRowType4()private voiddecodeRowType6()private intdecodeRun(CCITTFaxDecoderStream.Tree tree)private voidfetch()private intgetNextChangingElement(int a0, boolean white)booleanmarkSupported()intread()intread(byte[] b, int off, int len)private booleanreadBit()voidreset()private voidresetBuffer()longskip(long n)
-
-
-
Field Detail
-
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
static final CCITTFaxDecoderStream.Node EOL
-
FILL
static final CCITTFaxDecoderStream.Node FILL
-
blackRunTree
static final CCITTFaxDecoderStream.Tree blackRunTree
-
whiteRunTree
static final CCITTFaxDecoderStream.Tree whiteRunTree
-
eolOnlyTree
static final CCITTFaxDecoderStream.Tree eolOnlyTree
-
codeTree
static final CCITTFaxDecoderStream.Tree codeTree
-
VALUE_EOL
static final int VALUE_EOL
- See Also:
- Constant Field Values
-
VALUE_FILL
static final int VALUE_FILL
- See Also:
- Constant Field Values
-
VALUE_PASSMODE
static final int VALUE_PASSMODE
- See Also:
- Constant Field Values
-
VALUE_HMODE
static final int VALUE_HMODE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CCITTFaxDecoderStream
CCITTFaxDecoderStream(java.io.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_T4orCOMPRESSION_CCITT_T6.options- CCITT T.4 or T.6 options.byteAligned- enable byte alignment used in PDF files (EncodedByteAlign).
-
-
Method Detail
-
fetch
private void fetch() throws java.io.IOException- Throws:
java.io.IOException
-
decode1D
private void decode1D() throws java.io.IOException- Throws:
java.io.IOException
-
decode2D
private void decode2D() throws java.io.IOException- Throws:
java.io.IOException
-
getNextChangingElement
private int getNextChangingElement(int a0, boolean white)
-
decodeRowType2
private void decodeRowType2() throws java.io.IOException- Throws:
java.io.IOException
-
decodeRowType4
private void decodeRowType4() throws java.io.IOException- Throws:
java.io.IOException
-
decodeRowType6
private void decodeRowType6() throws java.io.IOException- Throws:
java.io.IOException
-
decodeRow
private void decodeRow() throws java.io.IOException- Throws:
java.io.IOException
-
decodeRun
private int decodeRun(CCITTFaxDecoderStream.Tree tree) throws java.io.IOException
- Throws:
java.io.IOException
-
resetBuffer
private void resetBuffer()
-
readBit
private boolean readBit() throws java.io.IOException- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException- Overrides:
skipin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classjava.io.FilterInputStream
-
reset
public void reset() throws java.io.IOException- Overrides:
resetin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
-