Skip to content

okio / okio / DeflaterSink


(jvm) class DeflaterSink :Sink

A sink that uses DEFLATE to compress data written to another source.

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> DeflaterSink(sink:Sink, deflater:Deflater)


Name Summary
(jvm) close fun close():Unit
(jvm) flush fun flush():Unit
(jvm) timeout fun timeout():Timeout
(jvm) toString fun toString():String
(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