SdkSink
A destination for writing a stream of bytes (e.g. file, network, in-memory buffer). Sinks may be layered to transform received data, such as to compress, encrypt, throttle, or add protocol framing.
Most application code should not operate on a sink directly, but rather a SdkBufferedSink which is more convenient. Use SdkSink.buffer to wrap any sink with a buffer.
Thread/Coroutine Safety
Sinks are not thread safe by default. Do not share a sink between threads or coroutines without external synchronization.
This is a blocking interface! Use from coroutines should be done from an appropriate dispatcher (e.g. Dispatchers.IO
).
Inheritors
Inherited functions
Returns a new sink that buffers writes to the sink. Writes will be efficiently "batched". Call SdkSink.flush when done to emit all data to the underlying sink.