public abstract class CompositeJsonEncoder<Event extends DeferredProcessingAware> extends EncoderBase<Event> implements StreamingEncoder<Event>
started
context
Constructor and Description |
---|
CompositeJsonEncoder() |
isStarted
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
protected abstract AbstractCompositeJsonFormatter<Event> createFormatter()
public void encode(Event event, OutputStream outputStream) throws IOException
encode
in interface StreamingEncoder<Event extends DeferredProcessingAware>
IOException
public byte[] encode(Event event)
encode
in interface Encoder<Event extends DeferredProcessingAware>
public void start()
start
in interface LifeCycle
start
in class EncoderBase<Event extends DeferredProcessingAware>
public void stop()
stop
in interface LifeCycle
stop
in class EncoderBase<Event extends DeferredProcessingAware>
public byte[] headerBytes()
headerBytes
in interface Encoder<Event extends DeferredProcessingAware>
public byte[] footerBytes()
footerBytes
in interface Encoder<Event extends DeferredProcessingAware>
public JsonProviders<Event> getProviders()
public void setProviders(JsonProviders<Event> jsonProviders)
public JsonFactoryDecorator getJsonFactoryDecorator()
public void setJsonFactoryDecorator(JsonFactoryDecorator jsonFactoryDecorator)
public JsonGeneratorDecorator getJsonGeneratorDecorator()
public String getEncoding()
public void setEncoding(String encodingName)
UTF-8
").
Must an encoding supported by JsonEncoding
encodingName
- encoding namepublic void setFindAndRegisterJacksonModules(boolean findAndRegisterJacksonModules)
public void setJsonGeneratorDecorator(JsonGeneratorDecorator jsonGeneratorDecorator)
public String getLineSeparator()
public void setLineSeparator(String lineSeparator)
The following values have special meaning:
null
or empty string = no new line.SYSTEM
" = operating system new line (default).UNIX
" = unix line ending (\n
).WINDOWS
" = windows line ending \r\n
).Any other value will be used as given as the lineSeparator.
lineSeparator
- the line separatorpublic int getMinBufferSize()
public void setMinBufferSize(int minBufferSize)
The buffer automatically grows above the #minBufferSize
when needed to
accommodate with larger events. However, only the first minBufferSize
bytes
will be reused by subsequent invocations. It is therefore strongly advised to set
the minimum size at least equal to the average size of the encoded events to reduce
unnecessary memory allocations and reduce pressure on the garbage collector.
Note: changes to the buffer size will not be taken into account after the encoder is started.
minBufferSize
- minimum size of the byte buffer (in bytes)protected AbstractCompositeJsonFormatter<Event> getFormatter()
Copyright © 2013–2021. All rights reserved.