IN - The type that will be produced by decodingOUT - The type that will be consumed by encodingpublic class DelimitedCodec<IN,OUT> extends java.lang.Object implements Codec<Buffer,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.| 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 |
|---|---|
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.
|
Function<OUT,Buffer> |
encoder()
Provide the caller with an encoder to turn an output object into an instance of the source
type.
|
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.