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.FilterInputStream
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 fa0341f30237effe523e9905e672d709ffe9c6bd of 7.5.2016 from twelvemonkeys/imageio/plugins/tiff/CCITTFaxDecoderStream.java Initial changes for PDFBox, discussed in PDFBOX-3338: - added optionByteAligned to constructor and to each decodeRowType() method - removed Validate() usages - catch VALUE_EOL in decode1D()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
CCITTFaxDecoderStream.Node
private static class
CCITTFaxDecoderStream.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.Tree
blackRunTree
(package private) int
buffer
(package private) int
bufferPos
private int[]
changesCurrentRow
private int
changesCurrentRowCount
private int[]
changesReferenceRow
private int
changesReferenceRowCount
(package private) static CCITTFaxDecoderStream.Tree
codeTree
private int
columns
private int
decodedLength
private int
decodedPos
private byte[]
decodedRow
(package private) static CCITTFaxDecoderStream.Node
EOL
(package private) static CCITTFaxDecoderStream.Tree
eolOnlyTree
(package private) static CCITTFaxDecoderStream.Node
FILL
private int
fillOrder
private int
lastChangingElement
private boolean
optionByteAligned
private boolean
optionG32D
private boolean
optionG3Fill
private boolean
optionUncompressed
private int
type
(package private) static int
VALUE_EOL
(package private) static int
VALUE_FILL
(package private) static int
VALUE_HMODE
(package private) static int
VALUE_PASSMODE
static short[][]
WHITE_CODES
static short[][]
WHITE_RUN_LENGTHS
(package private) static CCITTFaxDecoderStream.Tree
whiteRunTree
-
Constructor Summary
Constructors Constructor Description CCITTFaxDecoderStream(java.io.InputStream stream, int columns, int type, int fillOrder, long options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
decode1D()
private void
decode2D()
private void
decodeRow()
private void
decodeRowType2()
private void
decodeRowType4()
private void
decodeRowType6()
private int
decodeRun(CCITTFaxDecoderStream.Tree tree)
private void
fetch()
private int
getNextChangingElement(int a0, boolean white)
boolean
markSupported()
int
read()
int
read(byte[] b, int off, int len)
private boolean
readBit()
void
reset()
private void
resetBuffer()
long
skip(long n)
-
-
-
Field Detail
-
columns
private final int columns
-
decodedRow
private final byte[] decodedRow
-
decodedLength
private int decodedLength
-
decodedPos
private int decodedPos
-
fillOrder
private final int fillOrder
-
type
private final int type
-
changesReferenceRow
private int[] changesReferenceRow
-
changesCurrentRow
private int[] changesCurrentRow
-
changesReferenceRowCount
private int changesReferenceRowCount
-
changesCurrentRowCount
private int changesCurrentRowCount
-
lastChangingElement
private int lastChangingElement
-
optionG32D
private boolean optionG32D
-
optionG3Fill
private boolean optionG3Fill
-
optionUncompressed
private boolean optionUncompressed
-
optionByteAligned
private boolean optionByteAligned
-
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
-
-
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:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.FilterInputStream
-
reset
public void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
-