IN
- The type that will be produced by decodingOUT
- The type that will be consumed by encodingpublic class DelimitedCodec<IN,OUT> extends BufferCodec<IN,OUT>
Codec
that decodes by splitting a Buffer
into segments
based on a delimiter and encodes by appending its delimiter to each piece of output.
During decoding the delegate is used to process each segment. During encoding the delegate
is used to create a buffer for each piece of output to which the delimiter is then appended.DEFAULT_DELIMITER, delimiter
Constructor and Description |
---|
DelimitedCodec(boolean stripDelimiter,
Codec<Buffer,IN,OUT> delegate)
Create a line-feed-delimited codec, using the given
Codec as a delegate. |
DelimitedCodec(byte delimiter,
boolean stripDelimiter,
Codec<Buffer,IN,OUT> delegate)
Create a delimited codec using the given delimiter and using the given
Codec
as a delegate. |
DelimitedCodec(Codec<Buffer,IN,OUT> delegate)
Create a line-feed-delimited codec, using the given
Codec as a delegate. |
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.
|
decode, encode
addDelimiterIfAny, decoder, doBufferDecode, doDelimitedBufferDecode, encoder, invokeCallbackOrReturn
public DelimitedCodec(Codec<Buffer,IN,OUT> delegate)
Codec
as a delegate.delegate
- The delegate Codec
.public DelimitedCodec(boolean stripDelimiter, Codec<Buffer,IN,OUT> delegate)
Codec
as a delegate.stripDelimiter
- Flag to indicate whether the delimiter should be stripped from the
chunk or not during decoding.delegate
- The delegate Codec
.public DelimitedCodec(byte delimiter, boolean stripDelimiter, Codec<Buffer,IN,OUT> delegate)
Codec
as a delegate.delimiter
- The delimiter to use.stripDelimiter
- Flag to indicate whether the delimiter should be stripped from the
chunk or not during decoding.delegate
- The delegate Codec
.Copyright © 2016. All rights reserved.