-
- All Implemented Interfaces:
-
com.mobwith.httpmodule.Sink,java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public final class GzipSink implements Sink
A sink that uses GZIP to compress written data to another sink.
Sync flushAggressive flushing of this stream may result in reduced compression. Each call to flush immediately compresses all currently-buffered data; this early compression may be less effective than compression performed without flushing.This is equivalent to using Deflater with the sync flush option. This class does not offer any partial flush mechanism. For best performance, only call flush when application behavior requires it.
-
-
Method Summary
Modifier and Type Method Description voidwrite(Buffer source, long byteCount)Removes {@code byteCount}bytes from{@code source}and appends them to this.voidflush()Pushes all buffered bytes to their final destination. Timeouttimeout()Returns the timeout for this sink. voidclose()Pushes all buffered bytes to their final destination and releases theresources held by this sink. final Deflaterdeflater()Returns the Deflater.Use it to access stats, dictionary, compression level, etc. -
-
Constructor Detail
-
GzipSink
GzipSink(Sink sink)
-
-
Method Detail
-
write
void write(Buffer source, long byteCount)
Removes
{@code byteCount}bytes from{@code source}and appends them to this.
-
flush
void flush()
Pushes all buffered bytes to their final destination.
-
close
void close()
Pushes all buffered bytes to their final destination and releases theresources held by this sink. It is an error to write a closed sink. It issafe to close a sink more than once.
-
-
-
-