Package org.apache.commons.imaging.common.itu_t4

## Class T4AndT6Compression

- java.lang.Object
- - org.apache.commons.imaging.common.itu_t4.T4AndT6Compression

-     public final class T4AndT6Compression
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `BLACK` |
    `static int` | `WHITE` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static byte[]` | `compressModifiedHuffman​(byte[] uncompressed, int width, int height)` | Compressed with the "Modified Huffman" encoding of section 10 in the TIFF6 specification.
    `static byte[]` | `compressT4_1D​(byte[] uncompressed, int width, int height, boolean hasFill)` |
    `static byte[]` | `compressT4_2D​(byte[] uncompressed, int width, int height, boolean hasFill, int parameterK)` |
    `static byte[]` | `compressT6​(byte[] uncompressed, int width, int height)` |
    `static byte[]` | `decompressModifiedHuffman​(byte[] compressed, int width, int height)` | Decompresses the "Modified Huffman" encoding of section 10 in the TIFF6 specification.
    `static byte[]` | `decompressT4_1D​(byte[] compressed, int width, int height, boolean hasFill)` | Decompresses T.4 1D encoded data.
    `static byte[]` | `decompressT4_2D​(byte[] compressed, int width, int height, boolean hasFill)` | Decompressed T.4 2D encoded data.
    `static byte[]` | `decompressT6​(byte[] compressed, int width, int height)` | Decompress T.6 encoded data.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### WHITE

          public static final int WHITE

      See Also:
        Constant Field Values

    - #### BLACK

          public static final int BLACK

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### compressModifiedHuffman

          public static byte[] compressModifiedHuffman​(byte[] uncompressed,
                                                       int width,
                                                       int height)
                                                throws ImageWriteException

      Compressed with the "Modified Huffman" encoding of section 10 in the TIFF6 specification. No EOLs, no RTC, rows are padded to end on a byte boundary.
      Parameters:
        `uncompressed` - uncompressed byte data
        `width` - image width
        `height` - image height
      Returns:
        the compressed data
      Throws:
        `ImageWriteException` - if it fails to write the compressed data

    - #### decompressModifiedHuffman

          public static byte[] decompressModifiedHuffman​(byte[] compressed,
                                                         int width,
                                                         int height)
                                                  throws ImageReadException

      Decompresses the "Modified Huffman" encoding of section 10 in the TIFF6 specification. No EOLs, no RTC, rows are padded to end on a byte boundary.
      Parameters:
        `compressed` - compressed byte data
        `width` - image width
        `height` - image height
      Returns:
        the compressed data
      Throws:
        `ImageReadException` - if it fails to read the compressed data

    - #### compressT4_1D

          public static byte[] compressT4_1D​(byte[] uncompressed,
                                             int width,
                                             int height,
                                             boolean hasFill)
                                      throws ImageWriteException

      Throws:
        `ImageWriteException`

    - #### decompressT4_1D

          public static byte[] decompressT4_1D​(byte[] compressed,
                                               int width,
                                               int height,
                                               boolean hasFill)
                                        throws ImageReadException

      Decompresses T.4 1D encoded data. EOL at the beginning and after each row, can be preceded by fill bits to fit on a byte boundary, no RTC.
      Parameters:
        `compressed` - compressed byte data
        `width` - image width
        `height` - image height
        `hasFill` - used to check the end of line
      Returns:
        the decompressed data
      Throws:
        `ImageReadException` - if it fails to read the compressed data

    - #### compressT4_2D

          public static byte[] compressT4_2D​(byte[] uncompressed,
                                             int width,
                                             int height,
                                             boolean hasFill,
                                             int parameterK)
                                      throws ImageWriteException

      Throws:
        `ImageWriteException`

    - #### decompressT4_2D

          public static byte[] decompressT4_2D​(byte[] compressed,
                                               int width,
                                               int height,
                                               boolean hasFill)
                                        throws ImageReadException

      Decompressed T.4 2D encoded data. EOL at the beginning and after each row, can be preceded by fill bits to fit on a byte boundary, and is succeeded by a tag bit determining whether the next line is encoded using 1D or 2D. No RTC.
      Parameters:
        `compressed` - compressed byte data
        `width` - image width
        `height` - image height
        `hasFill` - used to check the end of line
      Returns:
        the decompressed data
      Throws:
        `ImageReadException` - if it fails to read the compressed data

    - #### compressT6

          public static byte[] compressT6​(byte[] uncompressed,
                                          int width,
                                          int height)
                                   throws ImageWriteException

      Throws:
        `ImageWriteException`

    - #### decompressT6

          public static byte[] decompressT6​(byte[] compressed,
                                            int width,
                                            int height)
                                     throws ImageReadException

      Decompress T.6 encoded data. No EOLs, except for 2 consecutive ones at the end (the EOFB, end of fax block). No RTC. No fill bits anywhere. All data is 2D encoded.
      Parameters:
        `compressed` - compressed byte data
        `width` - image width
        `height` - image height
      Returns:
        the decompressed data
      Throws:
        `ImageReadException` - if it fails to read the compressed data