Interface Encoder<E>
- Type Parameters:
E- event type
- All Superinterfaces:
ContextAware, LifeCycle
- All Known Implementing Classes:
DummyEncoder, EchoEncoder, EncoderBase, JsonEncoder, LayoutWrappingEncoder, PatternLayoutEncoder, PatternLayoutEncoderBase
Encoders are responsible for transform an incoming event into a byte array
- Since:
- 0.9.19
- Author:
- Ceki Gülcü, Joern Huxhorn, Maarten Bosteels
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]Encode an event as bytes.byte[]Get footer bytes.byte[]Get header bytes.default booleanReturns true if the encoder is stateful, false otherwise.Methods inherited from interface ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Method Details
-
headerBytes
byte[] headerBytes()Get header bytes. This method is typically called upon opening of an output stream.- Returns:
- header bytes. Null values are allowed.
-
encode
-
isStateful
Returns true if the encoder is stateful, false otherwise.A stateful encoder keeps state between invocation of
encode(E event)method.A stateful encoder may produce different output for the same input event depending on its internal state. A stateless encoder will always produce the same output for the same input event.
- Returns:
- true if the encoder is stateful, false otherwise.
- Since:
- 1.6.4
-