Class TextEncoderHelper

java.lang.Object
org.apache.logging.log4j.core.layout.TextEncoderHelper

public class TextEncoderHelper extends Object
Helper class to encode text to binary data without allocating temporary objects.
Since:
2.6
  • Method Details

    • encodeText

      public static void encodeText(CharsetEncoder charsetEncoder, CharBuffer charBuf, ByteBuffer byteBuf, StringBuilder text, ByteBufferDestination destination)
      Converts the specified text to bytes and writes the resulting bytes to the specified destination. Attempts to postpone synchronizing on the destination as long as possible to minimize lock contention.
      Parameters:
      charsetEncoder - thread-local encoder instance for converting chars to bytes
      charBuf - thread-local text buffer for converting text to bytes
      byteBuf - thread-local buffer to temporarily hold converted bytes before copying them to the destination
      text - the text to convert and write to the destination
      destination - the destination to write the bytes to
    • encodeText

      @Deprecated public static void encodeText(CharsetEncoder charsetEncoder, CharBuffer charBuf, ByteBufferDestination destination)
      Deprecated.
      For testing purposes only.