Body

interface Body : Closeable(source)

If this Body is NOT being returned to the caller (via a Server implementation or otherwise), close() should be called.

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val length: Long?

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

Link copied to clipboard
abstract val payload: ByteBuffer
Link copied to clipboard
abstract val stream: InputStream
Link copied to clipboard
open 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
abstract 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.