MemoryBody

data class MemoryBody(val payload: ByteBuffer) : Body(source)

Represents a body that is backed by an in-memory ByteBuffer. Closing this has no effect.

Constructors

Link copied to clipboard
constructor(payload: ByteBuffer)
constructor(payload: String)
constructor(payload: ByteArray)

Properties

Link copied to clipboard
open override val length: Long

Will be null for bodies where it's impossible to a priori determine - e.g. StreamBody

Link copied to clipboard
open override val payload: ByteBuffer
Link copied to clipboard
open override val stream: ByteArrayInputStream
Link copied to clipboard
open override val text: String

Returns a string representation of the body, decoded as UTF-8. This will realize any underlying stream.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun Body.gunzipped(maxSize: Long = MAX_DECOMPRESSED_SIZE.toLong()): Body
Link copied to clipboard
fun Body.gunzippedStream(maxSize: Long = MAX_DECOMPRESSED_SIZE.toLong()): Body
Link copied to clipboard
fun Body.gzipped(compressionLevel: Int = DEFAULT_COMPRESSION): CompressionResult
Link copied to clipboard
fun Body.gzippedStream(compressionLevel: Int = DEFAULT_COMPRESSION): CompressionResult
Link copied to clipboard

This function works around input streams which report that there is nothing to read when they have never been accessed.

Link copied to clipboard
open override fun toString(): String