public class StringUtils extends Object
This class is immutable and thread-safe.
| Constructor and Description |
|---|
StringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getBytesUtf8(String string)
Encodes the given string into a sequence of bytes using the UTF-8 charset, storing the result into a new byte
array.
|
static String |
newStringUsAscii(byte[] bytes)
Constructs a new
String by decoding the specified array of bytes using the US-ASCII charset. |
static String |
newStringUtf8(byte[] bytes)
Constructs a new
String by decoding the specified array of bytes using the UTF-8 charset. |
public static byte[] getBytesUtf8(String string)
string - the String to encode, may be nullnull if the input string was nullpublic static String newStringUsAscii(byte[] bytes)
String by decoding the specified array of bytes using the US-ASCII charset.bytes - The bytes to be decoded into charactersString decoded from the specified array of bytes using the US-ASCII charset,
or null if the input byte array was null.public static String newStringUtf8(byte[] bytes)
String by decoding the specified array of bytes using the UTF-8 charset.bytes - The bytes to be decoded into charactersString decoded from the specified array of bytes using the UTF-8 charset,
or null if the input byte array was null.Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.