public abstract class SerializationCodec<E,IN,OUT> extends BufferCodec<IN,OUT>
Codec Codecs
that perform serialization of objects. Optionally handles writing class
names so that an object that is serialized can be properly instantiated with full type information on the other end.DEFAULT_DELIMITER, delimiter
Modifier | Constructor and Description |
---|---|
protected |
SerializationCodec(E engine,
boolean lengthFieldFraming)
Create a
SerializationCodec using the given engine and specifying whether or not to prepend a length field
to frame the message. |
Modifier and Type | Method and Description |
---|---|
Buffer |
apply(OUT out)
Execute the logic of the action, accepting the given parameter.
|
Function<Buffer,IN> |
decoder(Consumer<IN> next)
Provide the caller with a decoder to turn a source object into an instance of the input
type.
|
protected abstract Function<byte[],IN> |
deserializer(E engine,
Class<IN> type,
Consumer<IN> next) |
protected E |
getEngine() |
Class<IN> |
readType(Buffer buffer) |
protected abstract Function<OUT,byte[]> |
serializer(E engine) |
decode, encode
addDelimiterIfAny, decoder, doBufferDecode, doDelimitedBufferDecode, encoder, invokeCallbackOrReturn
protected SerializationCodec(E engine, boolean lengthFieldFraming)
SerializationCodec
using the given engine and specifying whether or not to prepend a length field
to frame the message.engine
- the engine which will perform the serializationlengthFieldFraming
- true
to prepend a length field, or false
to skippublic Function<Buffer,IN> decoder(Consumer<IN> next)
Codec
public Buffer apply(OUT out)
Function
out
- The parameter to pass to the action.protected E getEngine()
protected abstract Function<byte[],IN> deserializer(E engine, Class<IN> type, Consumer<IN> next)
Copyright © 2017. All rights reserved.