Class Flate


public class Flate extends Filter
Flate
  • Constructor Details

  • Method Details

    • decode

      public byte[] decode(byte[] data) throws Exception
      Flate decode - use a byte array stream to decompress data in memory
      Specified by:
      decode in class Filter
      Parameters:
      data - byte[] to decode
      Returns:
      byte[] of decompressed data
      Throws:
      Exception
    • decode

      public void decode(BufferedInputStream bis, BufferedOutputStream streamCache, String cacheName, Map<String,String> cachedObjects) throws Exception
      Flate decode
      Specified by:
      decode in class Filter
      Parameters:
      bis - BufferedInputStream
      streamCache - BufferedOutputStream
      cacheName - Name of the cache object
      cachedObjects - Map of cached objects
      Throws:
      Exception
    • encode

      public byte[] encode(byte[] data)
      Flate encode
      Specified by:
      encode in class Filter
      Parameters:
      data - Byte[] to be compressed
      Returns:
      byte[] of compressed data
    • encode

      public static byte[] encode(byte[] data, int compressionLevel)
      Flate encode
      Parameters:
      data - the byte[] to be compressed
      compressionLevel - the level of compression
      Returns:
      a byte[] of compressed data
    • encodeLF

      public static byte[] encodeLF(byte[] data, int compressionLevel)
      Flate encode with an LF appended to the end.

      Note that the LF is not part of the stream so when setting the stream Length in the dictionary, use (length - 1)

      Parameters:
      data - the byte[] to be compressed
      compressionLevel - the level of compression
      Returns:
      a byte[] of compressed data
    • encodeLF

      public static byte[] encodeLF(ByteBuffer data, int compressionLevel)
      Flate encode with an LF appended to the end.

      Note that the LF is not part of the stream so when setting the stream Length in the dictionary, use (length - 1)

      Parameters:
      data - the ByteBuffer to be compressed
      compressionLevel - the level of compression
      Returns:
      a byte[] of compressed data
    • encode

      public void encode(BufferedInputStream bis, BufferedOutputStream bos) throws Exception
      Flate encoding for Streams is currently unsupported
      Specified by:
      encode in class Filter
      Throws:
      Exception
    • hasError

      public boolean hasError()
      Description copied from class: Filter
      inherited by several methods
      Overrides:
      hasError in class Filter
      Returns:
      true if there is an error