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)
Deprecated.
No longer necessary given better performance in Java 8
|
static byte[] |
encodeSingleByteChars(CharSequence s)
Deprecated.
No longer necessary given better performance in Java 8
|
static int |
encodeString(CharSequence charArray,
int charOffset,
int charLength,
byte[] byteArray)
Deprecated.
No longer necessary given better performance in Java 8
|
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.@Deprecated public static byte[] encodeSingleByteChars(CharSequence s)
String.getBytes(Charset)
which performs better in Java 8 and beyond.
Encodes the specified char sequence by casting each character to a byte.s
- the char sequence to encode@Deprecated public static int encodeIsoChars(CharSequence charArray, int charIndex, byte[] byteArray, int byteIndex, int length)
String.getBytes(Charset)
which performs better in Java 8 and beyond.
Implementation note: this is the fast path. If the char array contains only ISO-8859-1 characters, all the work
will be done here.@Deprecated public static int encodeString(CharSequence charArray, int charOffset, int charLength, byte[] byteArray)
String.getBytes(Charset)
which performs better in Java 8 and beyond. Copyright © 1999-2023 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.