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
-
Method Summary
Modifier and TypeMethodDescriptionfinal LogEncoder.Buffer
buffer
(LogEncoder.BufferHints hints) Creates a new buffer.protected abstract T
doBuffer
(LogEncoder.BufferHints hints) Create a specific buffer implementation.protected abstract void
A type safe version ofencode(LogEvent, Buffer)
.final void
encode
(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:LogEncoder
Creates a new buffer. The encoder should not try to reuse buffers as that is the responsibility of the appender (and possiblyLogOutput
but usually not). Hints can be retrieved by callLogOutput.bufferHints()
.- Specified by:
buffer
in interfaceLogEncoder
- Parameters:
hints
- hints are like size and storage type etc.- Returns:
- a new buffer.
-
encode
Description copied from interface:LogEncoder
Encodes an event to the buffer. It is recommended that the encoder callLogEncoder.Buffer.clear()
before using.- Specified by:
encode
in interfaceLogEncoder
- Parameters:
event
- log event.buffer
- buffer created fromLogEncoder.buffer(BufferHints)
.
-