scuttlebutt-rpc / org.apache.tuweni.scuttlebutt.rpc / RPCCodec

RPCCodec

class RPCCodec (source)

Encoder responsible for encoding requests.

This encoder is stateful as it maintains a counter to provide different request ids over time.

Constructors

<init>

RPCCodec()

Encoder responsible for encoding requests.

This encoder is stateful as it maintains a counter to provide different request ids over time.

Functions

encodeRequest

static fun encodeRequest(body: String, vararg flags: RPCFlag): Bytes
static fun encodeRequest(body: Bytes, vararg flags: RPCFlag): Bytes
static fun encodeRequest(body: Bytes, requestNumber: Int, vararg flags: RPCFlag): Bytes

Encode a message as a RPC request.

static fun encodeRequest(body: Bytes, requestNumber: Int, flags: Byte): Bytes

Encode a message as an RPC request.

encodeResponse

static fun encodeResponse(body: Bytes, requestNumber: Int, flagByte: Byte): Bytes
static fun encodeResponse(body: Bytes, requestNumber: Int, flagByte: Byte, vararg flags: RPCFlag): Bytes
static fun encodeResponse(body: Bytes, requestNumber: Int, vararg flags: RPCFlag): Bytes

Encode a message as a response to a RPC request.

encodeStreamEndRequest

static fun encodeStreamEndRequest(requestNumber: Int): Bytes

Encodes a message with the body and headers set in the appropriate way to end a stream.