vertx / io.vertx.ext.web.codec / BodyCodec

BodyCodec

interface BodyCodec<T : Any>

A codec for encoding and decoding HTTP bodies.

Author
Julien Viet

Functions

buffer

open static fun buffer(): BodyCodec<Buffer>

create

abstract fun create(handler: Handler<AsyncResult<BodyStream<T>>>): Unit

Create the BodyStream.

This method is usually called for creating the pump for the HTTP response and should not be called directly.

open static fun <T : Any> create(decode: Function<Buffer, T>): BodyCodec<T>

Create a codec that buffers the entire body and then apply the decode function and returns the result.

json

open static fun <U : Any> json(type: Class<U>): BodyCodec<U>

Create and return a codec for Java objects encoded using Jackson mapper.

jsonArray

open static fun jsonArray(): BodyCodec<JsonArray>

jsonObject

open static fun jsonObject(): BodyCodec<JsonObject>

none

open static fun none(): BodyCodec<Void>

pipe

open static fun pipe(stream: WriteStream<Buffer>): BodyCodec<Void>

A body codec that pipes the body to a write stream.

string

open static fun string(): BodyCodec<String>open static fun string(encoding: String): BodyCodec<String>

A codec for strings using a specific encoding.