Class GzipSink

java.lang.Object
org.miaixz.bus.core.io.sink.GzipSink
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, Sink

public class GzipSink extends Object implements Sink
这相当于使用Deflater同步刷新选项 该类不提供任何部分刷新机制 为获得最佳性能, 只在应用程序行为需要时调用flush()
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • GzipSink

      public GzipSink(Sink sink)
  • Method Details

    • write

      public void write(Buffer source, long byteCount) throws IOException
      Description copied from interface: Sink
      Removes byteCount bytes from source and appends them to this.
      Specified by:
      write in interface Sink
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Description copied from interface: Sink
      Pushes all buffered bytes to their final destination.
      Specified by:
      flush in interface Flushable
      Specified by:
      flush in interface Sink
      Throws:
      IOException
    • timeout

      public Timeout timeout()
      Description copied from interface: Sink
      Returns the timeout for this sink.
      Specified by:
      timeout in interface Sink
      Returns:
      the Timeout
    • close

      public void close() throws IOException
      Description copied from interface: Sink
      Pushes all buffered bytes to their final destination and releases the resources held by this sink. It is an error to write a closed sink. It is safe to close a sink more than once.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Sink
      Throws:
      IOException
    • deflater

      public final Deflater deflater()
      Returns the Deflater. Use it to access stats, dictionary, compression level, etc.