Class TextEncoderHelper
java.lang.Object
org.apache.logging.log4j.core.layout.TextEncoderHelper
Helper class to encode text to binary data without allocating temporary objects.
- Since:
- 2.6
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.static void
encodeText
(CharsetEncoder charsetEncoder, CharBuffer charBuf, ByteBufferDestination destination) Deprecated.
-
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 bytescharBuf
- thread-local text buffer for converting text to bytesbyteBuf
- thread-local buffer to temporarily hold converted bytes before copying them to the destinationtext
- the text to convert and write to the destinationdestination
- the destination to write the bytes to
-
encodeText
@Deprecated public static void encodeText(CharsetEncoder charsetEncoder, CharBuffer charBuf, ByteBufferDestination destination) Deprecated.For testing purposes only.
-