class HttpResponseBody
source · line 13public class HttpResponseBody internal constructor(private val input: ClientResponseInput, private val fields: Array<HttpField>) : AsyncByteSource, AsyncCloseable
- Supertype
AsyncByteSource - Supertype
AsyncCloseable
A single forward-only response-body cursor with optional content decoding. Reads must not overlap; buffering helpers require an explicit byte limit.
property contentLength
source · line 24public val contentLength: Long?
get: public read-only
The length of the delivered representation when known; automatic decoding can make this unknown.
getter get
source · line 24get(): Option<Long>
function copyTo
source · line 47public suspend fun copyTo(destination: AsyncByteSink, bufferSize: Long = 8192L): Long
Streams the remaining body into the borrowed sink using a positive buffer size.
parameter destination
source · line 47destination: AsyncByteSink
parameter bufferSize
source · line 47bufferSize: Long = 8192L
function close
source · line 86public override suspend fun close(): Unit
- Overrides
close
Ends body consumption and awaits upload, stream, and call cleanup.
function text
source · line 54public suspend fun text(maxBytes: Long, charset: Charset? = None, options: CharsetDecodeOptions = CharsetDecodeOptions(), malformedInput: CharsetErrorAction = CharsetErrorAction.Strict): String
Buffers under maxBytes and decodes using the explicit charset, Content-Type charset, or UTF-8 fallback. Malformed input is strict unless replacement is requested.
parameter charset
source · line 54charset: Charset? = None
parameter options
source · line 54options: CharsetDecodeOptions = CharsetDecodeOptions()
parameter malformedInput
source · line 55malformedInput: CharsetErrorAction = CharsetErrorAction.Strict
parameter maxBytes
source · line 54maxBytes: Long
function json
source · line 71public suspend fun <T> json(maxBytes: Long): T where T.Companion : ValueDecoder<T>
Consumes this body once as JSON using the type companion and the same byte limit.
type parameter T
source · line 71T
parameter maxBytes
source · line 71maxBytes: Long
function json
source · line 67public suspend fun <T> json(codec: ValueDecoder<T>, maxBytes: Long): T
Buffers under maxBytes, strictly decodes UTF-8, and uses the supplied JSON value decoder.
parameter maxBytes
source · line 67maxBytes: Long
parameter codec
source · line 67codec: ValueDecoder<T>
type parameter T
source · line 67T
property isComplete
source · line 19public val isComplete: Boolean
get: public read-only
Whether the complete body and finalization have succeeded.
getter get
source · line 19get(): Boolean
function bytes
source · line 42public suspend fun bytes(maxBytes: Long): Array<Byte>
Buffers the remaining body under an explicit byte limit.
parameter maxBytes
source · line 42maxBytes: Long
function readAllBytes
source · line 36public suspend fun readAllBytes(maxBytes: Long): Array<Byte>
Buffers the remaining body under an explicit byte limit; the body is not rewound.
parameter maxBytes
source · line 36maxBytes: Long
function readInto
source · line 30public override suspend fun readInto(buffer: NativeByteBuffer, count: Long): Long
- Overrides
readInto
Reads up to count bytes into the writable buffer; positive-count zero indicates EOF. Only one reader may be active.
parameter count
source · line 30count: Long
parameter buffer
source · line 30buffer: NativeByteBuffer