Module io.jstach.rainbowgum
Package io.jstach.rainbowgum
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:
GelfEncoder
- 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 io.jstach.rainbowgum.LogEncoder
LogEncoder.AbstractEncoder<T extends LogEncoder.Buffer>, LogEncoder.Buffer, LogEncoder.BufferHints, LogEncoder.EncoderProvider -
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).
-