Class Deflate

java.lang.Object
com.luna.common.file.compress.Deflate
All Implemented Interfaces:
Closeable, AutoCloseable

public class Deflate extends Object implements Closeable
Deflate算法
Deflate是同时使用了LZ77算法与哈夫曼编码(Huffman Coding)的一个无损数据压缩算法。
Since:
5.7.8
Author:
looly
  • Constructor Details

    • Deflate

      public Deflate(InputStream source, OutputStream target, boolean nowrap)
      构造
      Parameters:
      source - 源流
      target - 目标流
      nowrap - true表示兼容Gzip压缩
  • Method Details

    • of

      public static Deflate of(InputStream source, OutputStream target, boolean nowrap)
      创建Deflate
      Parameters:
      source - 源流
      target - 目标流
      nowrap - true表示兼容Gzip压缩
      Returns:
      this
    • getTarget

      public OutputStream getTarget()
      获取目标流
      Returns:
      目标流
    • deflater

      public Deflate deflater(int level)
      将普通数据流压缩
      Parameters:
      level - 压缩级别,0~9
      Returns:
      this
    • inflater

      public Deflate inflater()
      将压缩流解压到target中
      Returns:
      this
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable