Package org.apache.commons.imaging.common

## Class ZlibDeflate

- java.lang.Object
- - org.apache.commons.imaging.common.ZlibDeflate

-     public class ZlibDeflate
      extends Object

  Utility class to compress/decompress bytes using the ZLIB deflate/inflate compression.

  RFC 1951 - DEFLATE Compressed Data Format Specification version 1.3

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ZlibDeflate()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static byte[]` | `compress​(byte[] bytes)` | Compress the byte[] using ZLIB deflate compression.
    `static byte[]` | `decompress​(byte[] bytes, int expectedSize)` | Compress the byte[] using ZLIB deflate decompression.

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

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

- - ### Constructor Detail

    - #### ZlibDeflate

          public ZlibDeflate()

  - ### Method Detail

    - #### decompress

          public static byte[] decompress​(byte[] bytes,
                                          int expectedSize)
                                   throws ImageReadException

      Compress the byte[] using ZLIB deflate decompression.
      Parameters:
        `bytes` - The bytes to decompress
        `expectedSize` - The expected size of the decompressed byte[].
      Returns:
        The decompressed bytes.
      Throws:
        `ImageReadException` - if the bytes could not be decompressed.
      See Also:
        `Inflater`

    - #### compress

          public static byte[] compress​(byte[] bytes)
                                 throws ImageWriteException

      Compress the byte[] using ZLIB deflate compression.
      Parameters:
        `bytes` - The bytes to compress
      Returns:
        The compressed bytes.
      Throws:
        `ImageWriteException` - if the bytes could not be compressed.
      See Also:
        `DeflaterOutputStream`