ktor-http / io.ktor.http.content / OutgoingContent / WriteChannelContent

WriteChannelContent

abstract class WriteChannelContent : OutgoingContent

Variant of a OutgoingContent with payload written to ByteWriteChannel

Constructors

<init>

WriteChannelContent()

Variant of a OutgoingContent with payload written to ByteWriteChannel

Inherited Properties

contentLength

open val contentLength: Long?

Specifies content length in bytes for this resource.

contentType

open val contentType: ContentType?

Specifies ContentType for this resource.

headers

open val headers: Headers

Headers to set when sending this content

status

open val status: HttpStatusCode?

Status code to set when sending this content

Functions

writeTo

abstract suspend fun writeTo(channel: ByteWriteChannel): Unit

Receives channel provided by the engine and writes all data to it

Inherited Functions

getProperty

open fun <T : Any> getProperty(key: AttributeKey<T>): T?

Gets an extension property for this content

setProperty

open fun <T : Any> setProperty(key: AttributeKey<T>, value: T?): Unit

Sets an extension property for this content

Inheritors

ChannelWriterContent

class ChannelWriterContent : WriteChannelContent

OutgoingContent to respond with ByteWriteChannel. The stream would be automatically closed after body finish.

OutputStreamContent

class OutputStreamContent : WriteChannelContent

OutgoingContent to respond with OutputStream. The stream would be automatically closed after body finish.

WriterContent

class WriterContent : WriteChannelContent

Represents a content that is produced by body function