Class 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 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()
    • 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
      • fillOrder

        private final int fillOrder
      • 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
    • Constructor Detail

      • CCITTFaxDecoderStream

        public CCITTFaxDecoderStream​(java.io.InputStream stream,
                                     int columns,
                                     int type,
                                     int fillOrder,
                                     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 of COMPRESSION_CCITT_MODIFIED_HUFFMAN_RLE, COMPRESSION_CCITT_T4 or COMPRESSION_CCITT_T6.
        fillOrder - fillOrder, must be FILL_LEFT_TO_RIGHT or FILL_RIGHT_TO_LEFT.
        options - CCITT T.4 or T.6 options.
        byteAligned - enable byte alignment used in PDF files (EncodedByteAlign).
      • CCITTFaxDecoderStream

        public CCITTFaxDecoderStream​(java.io.InputStream stream,
                                     int columns,
                                     int type,
                                     int fillOrder,
                                     long options)
        Creates a CCITTFaxDecoderStream.
        Parameters:
        stream - the compressed CCITT stream.
        columns - the number of columns in the stream.
        type - the type of stream, must be one of COMPRESSION_CCITT_MODIFIED_HUFFMAN_RLE, COMPRESSION_CCITT_T4 or COMPRESSION_CCITT_T6.
        fillOrder - fillOrder, must be FILL_LEFT_TO_RIGHT or FILL_RIGHT_TO_LEFT.
        options - CCITT T.4 or T.6 options.
    • 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
      • 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 class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.FilterInputStream
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.FilterInputStream
        Throws:
        java.io.IOException