ByteArrayContent

class ByteArrayContent(bytes: ByteArray, val contentType: ContentType? = null, val status: HttpStatusCode? = null) : OutgoingContent.ByteArrayContent

Implementation of the OutgoingContent.ByteArrayContent for sending array of bytes

Constructors

Link copied to clipboard
constructor(bytes: ByteArray, contentType: ContentType? = null, status: HttpStatusCode? = null)

Properties

Link copied to clipboard

Gets or sets the CacheControl instance as an extension property on this content.

Link copied to clipboard
open override val contentLength: Long

Specifies content length in bytes for this resource.

Link copied to clipboard
open override val contentType: ContentType? = null

Specifies ContentType for this resource.

Link copied to clipboard
open val headers: Headers

Headers to set when sending this content

Link copied to clipboard
open override val status: HttpStatusCode? = null

Status code to set when sending this content

Link copied to clipboard

Gets or sets a list of Version instances as an extension property on this content.

Functions

Link copied to clipboard
open override fun bytes(): ByteArray

Provides ByteArray which engine will send to peer

Link copied to clipboard
fun OutgoingContent.compressed(contentEncoder: ContentEncoder, coroutineContext: CoroutineContext = EmptyCoroutineContext): OutgoingContent?

Returns OutgoingContent compressed with contentEncoder if possible.

Link copied to clipboard
open fun <T : Any> getProperty(key: AttributeKey<T>): T?

Gets an extension property for this content

Link copied to clipboard

Check if current OutgoingContent doesn't contain content

Link copied to clipboard
open fun <T : Any> setProperty(key: AttributeKey<T>, value: T?)

Sets an extension property for this content

Link copied to clipboard
open fun trailers(): Headers?

Trailers to set when sending this content, will be ignored if request is not in HTTP2 mode