public class LayoutWrappingEncoder<E> extends EncoderBase<E>
Modifier and Type | Field and Description |
---|---|
protected Layout<E> |
layout |
outputStream, started
context
Constructor and Description |
---|
LayoutWrappingEncoder() |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method is called prior to the closing of the underling
OutputStream . |
void |
doEncode(E event)
Encode and write an event to the appropriate
OutputStream . |
Charset |
getCharset() |
Layout<E> |
getLayout() |
void |
init(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(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() |
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
public void setImmediateFlush(boolean immediateFlush)
immediateFlush
- desired valuepublic boolean isImmediateFlush()
public Charset getCharset()
public void setCharset(Charset charset)
By default this property has the value
null
which corresponds to
the system's default charset.
charset
- desired character setpublic void init(OutputStream os) throws IOException
Encoder
init
in interface Encoder<E>
init
in class EncoderBase<E>
os
- the output streamIOException
- failed to initialize the streampublic void close() throws IOException
Encoder
OutputStream
. Implementations MUST not close the underlying
OutputStream
which is the responsibility of the owning appender.IOException
- failed to close output streampublic void doEncode(E event) throws IOException
Encoder
OutputStream
.
Implementations are free to differ writing out of the encoded event and
instead write in batches.event
- the log eventIOException
- failed to write log event to streampublic boolean isStarted()
isStarted
in interface LifeCycle
isStarted
in class EncoderBase<E>
public void start()
start
in interface LifeCycle
start
in class EncoderBase<E>
public void stop()
stop
in interface LifeCycle
stop
in class EncoderBase<E>
Copyright © 2005–2014 QOS.ch. All rights reserved.