public class LayoutWrappingEncoder<E> extends EncoderBase<E>
| Modifier and Type | Field and Description |
|---|---|
private java.nio.charset.Charset |
charset
The charset to use when converting a String into bytes.
|
private boolean |
immediateFlush |
protected Layout<E> |
layout |
outputStream, startedcontext| Constructor and Description |
|---|
LayoutWrappingEncoder() |
| Modifier and Type | Method and Description |
|---|---|
private void |
appendIfNotNull(java.lang.StringBuilder sb,
java.lang.String s) |
void |
close()
This method is called prior to the closing of the underling
OutputStream. |
private byte[] |
convertToBytes(java.lang.String s) |
void |
doEncode(E event)
Encode and write an event to the appropriate
OutputStream. |
java.nio.charset.Charset |
getCharset() |
Layout<E> |
getLayout() |
void |
init(java.io.OutputStream os)
This method is called when the owning appender starts or whenever output
needs to be directed to a new OutputStream, for instance as a result of a
rollover.
|
boolean |
isImmediateFlush() |
boolean |
isStarted() |
void |
setCharset(java.nio.charset.Charset charset)
Set the charset to use when converting the string returned by the layout
into bytes.
|
void |
setImmediateFlush(boolean immediateFlush)
Sets the immediateFlush option.
|
void |
setLayout(Layout<E> layout) |
void |
start() |
void |
stop() |
(package private) void |
writeFooter() |
(package private) void |
writeHeader() |
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContextprivate java.nio.charset.Charset charset
null which corresponds to
the system's default charset.private boolean immediateFlush
public void setImmediateFlush(boolean immediateFlush)
public boolean isImmediateFlush()
public java.nio.charset.Charset getCharset()
public void setCharset(java.nio.charset.Charset charset)
null which corresponds to
the system's default charset.charset - public void init(java.io.OutputStream os)
throws java.io.IOException
Encodervoid writeHeader()
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
EncoderOutputStream. Implementations MUST not close the underlying
OutputStream which is the responsibility of the owning appender.java.io.IOExceptionvoid writeFooter()
throws java.io.IOException
java.io.IOExceptionprivate byte[] convertToBytes(java.lang.String s)
public void doEncode(E event) throws java.io.IOException
EncoderOutputStream.
Implementations are free to differ writing out of the encoded event and
instead write in batches.java.io.IOExceptionpublic boolean isStarted()
isStarted in interface LifeCycleisStarted in class EncoderBase<E>public void start()
start in interface LifeCyclestart in class EncoderBase<E>public void stop()
stop in interface LifeCyclestop in class EncoderBase<E>private void appendIfNotNull(java.lang.StringBuilder sb,
java.lang.String s)