DeflaterSink

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

Constructors

Link copied to clipboard
expect constructor(sink: Sink, deflater: Deflater)

Functions

Link copied to clipboard

Returns a new sink that buffers writes to sink. The returned sink will batch writes to sink. Use this wherever you write to a sink to get an ergonomic and efficient access to data.

Link copied to clipboard

Returns a sink that uses cipher to encrypt or decrypt this.

Link copied to clipboard
expect abstract override fun close()

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.

Link copied to clipboard
inline fun Sink.deflate(deflater: Deflater = Deflater()): DeflaterSink

Returns an DeflaterSink that DEFLATE-compresses data to this Sink while writing.

Link copied to clipboard
expect abstract fun flush()

Pushes all buffered bytes to their final destination.

Link copied to clipboard
inline fun Sink.gzip(): GzipSink

Returns a GzipSink that gzip-compresses to this Sink while writing.

Link copied to clipboard

Returns a sink that uses digest to hash this.

Returns a sink that uses mac to hash this.

Link copied to clipboard
expect abstract fun timeout(): Timeout

Returns the timeout for this sink.

Link copied to clipboard
expect abstract fun write(source: Buffer, byteCount: Long)

Removes byteCount bytes from source and appends them to this.