Skip to content

okio / okio / GzipSink


(jvm) class GzipSink :Sink

A sink that uses GZIP to compress written data to another sink.

Sync flush

Aggressive 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.


Name Summary
(jvm) <init> A sink that uses GZIP to compress written data to another sink.GzipSink(sink:Sink)


Name Summary
(jvm) deflater The deflater used to compress the body.val deflater:Deflater


Name Summary
(jvm) close fun close():Unit
(jvm) deflater fun ~~deflater~~():Deflater
(jvm) flush fun flush():Unit
(jvm) timeout fun timeout():Timeout
(jvm) write fun write(source:Buffer, byteCount:Long):Unit

Extension Functions

Name Summary
(jvm) deflate Returns an DeflaterSink that DEFLATE-compresses data to this Sink while writing.funSink.deflate(deflater:Deflater= Deflater()):DeflaterSink
(jvm) gzip Returns a GzipSink that gzip-compresses to this Sink while writing.funSink.gzip():GzipSink