Class LogEncoder.AbstractEncoder<T extends LogEncoder.Buffer>
java.lang.Object
io.jstach.rainbowgum.LogEncoder.AbstractEncoder<T>
- Type Parameters:
T- buffer type.
- All Implemented Interfaces:
LogEncoder
- Direct Known Subclasses:
EcsEncoder, GelfEncoder, LogbackJsonEncoder, LogstashEncoder
- Enclosing interface:
LogEncoder
public abstract static class LogEncoder.AbstractEncoder<T extends LogEncoder.Buffer>
extends Object
implements LogEncoder
Abstract encoder that will cast the buffer to the desired implementation. Extend to
make creating encoders easier.
-
Nested Class Summary
Nested classes/interfaces inherited from interface LogEncoder
LogEncoder.AbstractEncoder<T>, LogEncoder.Buffer, LogEncoder.BufferHints, LogEncoder.Builder, LogEncoder.EncoderProviderModifier and TypeInterfaceDescriptionstatic classLogEncoder.AbstractEncoder<T extends LogEncoder.Buffer>Abstract encoder that will cast the buffer to the desired implementation.static interfaceEncoders buffer.static interfaceHints the output can pass to the encoder for creating buffers like max size and storage style of the buffer etc.static final classBuilds aLogEncoderout of aLogFormatter.static interfaceFinds output based on URI. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal LogEncoder.Bufferbuffer(LogEncoder.BufferHints hints) Creates a new buffer.protected abstract TdoBuffer(LogEncoder.BufferHints hints) Create a specific buffer implementation.protected abstract voidA type safe version ofencode(LogEvent, Buffer).final voidencode(LogEvent event, LogEncoder.Buffer buffer) Encodes an event to the buffer.
-
Constructor Details
-
AbstractEncoder
protected AbstractEncoder()Do nothing constructor.
-
-
Method Details
-
doBuffer
Create a specific buffer implementation.- Parameters:
hints- buffer creation hints.- Returns:
- buffer
-
doEncode
A type safe version ofencode(LogEvent, Buffer).- Parameters:
event- event.buffer- casted buffer.
-
buffer
Description copied from interface:LogEncoderCreates a new buffer. The encoder should not try to reuse buffers as that is the responsibility of the appender (and possiblyLogOutputbut usually not). Hints can be retrieved by callLogOutput.bufferHints().- Specified by:
bufferin interfaceLogEncoder- Parameters:
hints- hints are like size and storage type etc.- Returns:
- a new buffer.
-
encode
Description copied from interface:LogEncoderEncodes an event to the buffer. It is recommended that the encoder callLogEncoder.Buffer.clear()before using.- Specified by:
encodein interfaceLogEncoder- Parameters:
event- log event.buffer- buffer created fromLogEncoder.buffer(BufferHints).
-