SdkBufferedSink

expect interface SdkBufferedSink : SdkSink

A sink that keeps a buffer internally so that callers can do small writes without a performance penalty.

Inheritors

A sink that keeps a buffer internally so that callers can do small writes without a performance penalty.

Inheritors

Properties

Link copied to clipboard
expect abstract val buffer: SdkBuffer

The underlying buffer for this sink

actual abstract val buffer: SdkBuffer

The underlying buffer for this sink

Functions

Link copied to clipboard
expect abstract fun emit()

Writes all buffered data to the underlying sink. Like flush, but weaker (ensures data is pushed to the underlying sink but not necessarily all the way down the chain like flush does). Call before this sink goes out of scope to ensure any buffered data eventually gets to its final destination

actual abstract fun emit()

Writes all buffered data to the underlying sink. Like flush, but weaker (ensures data is pushed to the underlying sink but not necessarily all the way down the chain like flush does). Call before this sink goes out of scope to ensure any buffered data eventually gets to its final destination

Link copied to clipboard
expect abstract override fun flush()

Writes all buffered data to the underlying sink and pushes it recursively all the way to its final destination.

actual abstract override fun flush()

Writes all buffered data to the underlying sink.

Link copied to clipboard
abstract fun outputStream(): OutputStream

Return an output stream that writes to this sink

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

Removes byteCount bytes from source and writes them to this sink.

expect abstract fun write(source: ByteArray, offset: Int = 0, limit: Int = source.size - offset)

Write limit bytes from source starting at offset

actual abstract fun write(source: SdkSource, byteCount: Long)

Removes byteCount bytes from source and writes them to this sink.

actual abstract fun write(source: ByteArray, offset: Int, limit: Int)

Write limit bytes from source starting at offset

Link copied to clipboard
expect abstract fun writeAll(source: SdkSource): Long

Write all bytes from source to this sink.

actual abstract fun writeAll(source: SdkSource): Long

Write all bytes from source to this sink.

Link copied to clipboard
expect abstract fun writeByte(x: Byte)

Writes byte x to this sink

actual abstract fun writeByte(x: Byte)

Writes byte x to this sink

Link copied to clipboard
expect abstract fun writeInt(x: Int)

Writes int x as a big-endian bytes to this sink

actual abstract fun writeInt(x: Int)

Writes int x as a big-endian bytes to this sink

Link copied to clipboard
expect abstract fun writeIntLe(x: Int)

Writes int x as a little-endian bytes to this sink

actual abstract fun writeIntLe(x: Int)

Writes int x as a little-endian bytes to this sink

Link copied to clipboard
expect abstract fun writeLong(x: Long)

Writes long x as a big-endian bytes to this sink

actual abstract fun writeLong(x: Long)

Writes long x as a big-endian bytes to this sink

Link copied to clipboard
expect abstract fun writeLongLe(x: Long)

Writes long x as a little-endian bytes to this sink

actual abstract fun writeLongLe(x: Long)

Writes long x as a little-endian bytes to this sink

Link copied to clipboard
expect abstract fun writeShort(x: Short)

Writes short x as a big-endian bytes to this sink

actual abstract fun writeShort(x: Short)

Writes short x as a big-endian bytes to this sink

Link copied to clipboard
expect abstract fun writeShortLe(x: Short)

Writes short x as a little-endian bytes to this sink

actual abstract fun writeShortLe(x: Short)

Writes short x as a little-endian bytes to this sink

Link copied to clipboard
expect abstract fun writeUtf8(string: String, start: Int = 0, endExclusive: Int = string.length)

Write string as UTF-8 encoded bytes to this sink starting at start index up to endExclusive index.

actual abstract fun writeUtf8(string: String, start: Int, endExclusive: Int)

Write UTF8-bytes of string to this sink starting at start index up to endExclusive index.

Inherited functions

Link copied to clipboard

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.

Link copied to clipboard
abstract override fun close()

Pushes all buffered bytes to their final destination and releases resources held by this sink. It is an error to write to a closed sink. This is an idempotent operation.

abstract override fun close()

Pushes all buffered bytes to their final destination and releases resources held by this sink. It is an error to write to a closed sink. This is an idempotent operation.

Link copied to clipboard
abstract fun isOpen(): Boolean
Link copied to clipboard
fun SdkSink.toOkio(): <Error class: unknown class>
Link copied to clipboard
abstract fun write(source: SdkBuffer, byteCount: Long)

Removes byteCount bytes from source and appends them to this.

abstract fun write(source: SdkBuffer, byteCount: Long)

Removes byteCount bytes from source and appends them to this.

abstract fun write(p0: ByteBuffer): Int