Package ch.qos.logback.core.encoder

## Class LayoutWrappingEncoder<E>

- java.lang.Object
- - ch.qos.logback.core.spi.ContextAwareBase
  - - ch.qos.logback.core.encoder.EncoderBase<E>
    - - ch.qos.logback.core.encoder.LayoutWrappingEncoder<E>

All Implemented Interfaces:
  `Encoder<E>`, `ContextAware`, `LifeCycle`

Direct Known Subclasses:
  `PatternLayoutEncoderBase`

    public class LayoutWrappingEncoder<E>
    extends EncoderBase<E>

### Field Summary

Fields
`protected Layout<E>` `layout`

### Fields inherited from class ch.qos.logback.core.encoder.EncoderBase

`started`

### Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase

`context`

### Constructor Summary

Constructors
`LayoutWrappingEncoder()`

### Method Summary

All Methods Instance Methods Concrete Methods
`byte[]` `encode​(E event)` Encode an event as bytes.
`byte[]` `footerBytes()` Get footer bytes.
`java.nio.charset.Charset` `getCharset()`
`Layout<E>` `getLayout()`
`byte[]` `headerBytes()` Get header bytes.
`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` `setParent​(Appender<?> parent)` This method allows RollingPolicy implementations to be aware of their containing appender.
`void` `start()`
`void` `stop()`

### Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase

`addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface ch.qos.logback.core.spi.ContextAware

`addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext`

### Field Detail

#### layout

    protected Layout<E> layout

### Constructor Detail

#### LayoutWrappingEncoder

    public LayoutWrappingEncoder()

### Method Detail

#### getLayout

    public Layout<E> getLayout()

#### setLayout

    public void setLayout​(Layout<E> layout)

#### getCharset

    public java.nio.charset.Charset getCharset()

#### setCharset

    public void setCharset​(java.nio.charset.Charset charset)

Set the charset to use when converting the string returned by the layout into bytes.

By default this property has the value `null</null> which corresponds to the system's default charset.`

Parameters:
  `charset` -

#### setImmediateFlush

    public void setImmediateFlush​(boolean immediateFlush)

Sets the immediateFlush option. The default value for immediateFlush is 'true'. If set to true, the doEncode() method will immediately flush the underlying OutputStream. Although immediate flushing is safer, it also significantly degrades logging throughput.

Since:
  1.0.3

#### headerBytes

    public byte[] headerBytes()

Description copied from interface: `Encoder`
Get header bytes. This method is typically called upon opening of an output stream.

Returns:
  header bytes. Null values are allowed.

#### footerBytes

    public byte[] footerBytes()

Description copied from interface: `Encoder`
Get footer bytes. This method is typically called prior to the closing of the stream where events are written.

Returns:
  footer bytes. Null values are allowed.

#### encode

    public byte[] encode​(E event)

Description copied from interface: `Encoder`
Encode an event as bytes.

#### isStarted

    public boolean isStarted()

Specified by:
  `isStarted` in interface `LifeCycle`
Overrides:
  `isStarted` in class `EncoderBase<E>`

#### start

    public void start()

Specified by:
  `start` in interface `LifeCycle`
Overrides:
  `start` in class `EncoderBase<E>`

#### stop

    public void stop()

Specified by:
  `stop` in interface `LifeCycle`
Overrides:
  `stop` in class `EncoderBase<E>`

#### setParent

    public void setParent​(Appender<?> parent)

This method allows RollingPolicy implementations to be aware of their containing appender.

Parameters:
  `appender` -