public final class StringEncoder extends Object
Modifier and Type | Method and Description |
---|---|
static int |
encodeIsoChars(CharSequence charArray,
int charIndex,
byte[] byteArray,
int byteIndex,
int length) |
static byte[] |
encodeSingleByteChars(CharSequence s)
Encodes the specified char sequence by casting each character to a byte.
|
static int |
encodeString(CharSequence 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(CharSequence s)
s
- the char sequence to encodepublic static int encodeIsoChars(CharSequence charArray, int charIndex, byte[] byteArray, int byteIndex, int length)
public static int encodeString(CharSequence charArray, int charOffset, int charLength, byte[] byteArray)
Copyright © 1999-2021 The 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.