public final class StringEncoder extends Object
Modifier and Type | Method and Description |
---|---|
static int |
encodeIsoChars(String charArray,
int charIndex,
byte[] byteArray,
int byteIndex,
int length) |
static byte[] |
encodeSingleByteChars(String s)
Encodes the specified string by casting each character to a byte.
|
static int |
encodeString(String charArray,
int charOffset,
int charLength,
byte[] byteArray) |
static byte[] |
toBytes(String str,
Charset charset)
Converts a String to a byte[].
|
public static byte[] toBytes(String str, Charset charset)
str
- if null, return null.charset
- if null, use the default charset.public static byte[] encodeSingleByteChars(String s)
s
- the string to encodehttps://issues.apache.org/jira/browse/LOG4J2-1151
public static int encodeIsoChars(String charArray, int charIndex, byte[] byteArray, int byteIndex, int length)
public static int encodeString(String charArray, int charOffset, int charLength, byte[] byteArray)
Copyright © 1999-2017 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.