Buffer

abstract class Buffer : ByteStream

Variant of a ByteStream with payload represented as an in-memory byte buffer.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
override val isOneShot: Boolean = false

Flag indicating if the body can only be consumed once. If false the underlying stream must be capable of being replayed.

Inherited properties

Link copied to clipboard
open val contentLength: Long? = null

The content length if known

Functions

Link copied to clipboard
abstract fun bytes(): ByteArray

Provides ByteArray to be consumed. This MUST be idempotent as the data may be read multiple times.

Inherited functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Consume the ByteStream and pull the entire contents into memory as a ByteArray. Only do this if you are sure the contents fit in-memory as this will read the entire contents of a streaming variant.

Link copied to clipboard
fun ByteStream.toFlow(bufferSize: Long = 8192): <Error class: unknown class><ByteArray>

Return a Flow that consumes the underlying ByteStream when collected.