java.lang.Object
io.jstach.rainbowgum.json.JsonBuffer
- All Implemented Interfaces:
- LogEncoder.Buffer,- AutoCloseable
A buffer designed for encoding JSON efficiently.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumExtended fields are just fields that have some special prefix for things like GELF and ECS.static enumJSON tokens.Nested classes/interfaces inherited from interface io.jstach.rainbowgum.LogEncoder.BufferLogEncoder.Buffer.StringBuilderBuffer
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intA flag to indicate this field is extended which means it will be prefixed withJsonBuffer.ExtendedFieldPrefix.
- 
Constructor SummaryConstructorsConstructorDescriptionJsonBuffer(boolean prettyPrint, JsonBuffer.ExtendedFieldPrefix extendedFieldPrefix) Create a JSON buffer.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Prepare the buffer for reuse.voidThe appender will call this usually within a lock to transfer content from the buffer to the output.Reusable String buffer for formatted messages.final voidwrite(JsonBuffer.JSONToken token) Writes a JSON token.final intWrites a string field.final intWrites a string field.final intwriteDouble(String k, double v, int index, int flag) Writes a double field.final intWrites a string field.final voidEfficiently writes a line feed.Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jstach.rainbowgum.LogEncoder.Bufferclose
- 
Field Details- 
EXTENDED_FA flag to indicate this field is extended which means it will be prefixed withJsonBuffer.ExtendedFieldPrefix.- See Also:
 
 
- 
- 
Constructor Details- 
JsonBufferCreate a JSON buffer.- Parameters:
- prettyPrint- whether or not to pretty print the JSON.
- extendedFieldPrefix- prefix for extended fields.
 
 
- 
- 
Method Details- 
drainDescription copied from interface:LogEncoder.BufferThe appender will call this usually within a lock to transfer content from the buffer to the output.- Specified by:
- drainin interface- LogEncoder.Buffer
- Parameters:
- output- output to receive content.
- event- log event.
 
- 
clearDescription copied from interface:LogEncoder.BufferPrepare the buffer for reuse.An appender may not call clear before being passed to the encoder so the encoder should do its own clearing. - Specified by:
- clearin interface- LogEncoder.Buffer
 
- 
getFormattedMessageBuilderReusable String buffer for formatted messages.- Returns:
- buffer.
 
- 
writeWrites a JSON token.- Parameters:
- token- token not null.
 
- 
writeLineFeedEfficiently writes a line feed.
- 
writeWrites a string field.- Parameters:
- k- field name
- v- value
- index- the current index for comma determination
- Returns:
- index + 1
 
- 
writeWrites a string field.- Parameters:
- k- field name
- v- value
- index- the current index for comma determination
- flag- see- EXTENDED_F
- Returns:
- index + 1
 
- 
writeDoubleWrites a double field.- Parameters:
- k- field name
- v- value
- index- the current index for comma determination
- flag- see- EXTENDED_F
- Returns:
- index + 1
 
- 
writeIntWrites a string field.- Parameters:
- k- field name
- v- value
- index- the current index for comma determination
- flag- see- EXTENDED_F
- Returns:
- index + 1
 
 
-