public class StringUtils
extends java.lang.Object
This class is immutable and thread-safe.
Constructor and Description |
---|
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
getBytesUtf8(java.lang.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 java.lang.String |
newStringUsAscii(byte[] bytes)
Constructs a new
String by decoding the specified array of bytes using the US-ASCII charset. |
static java.lang.String |
newStringUtf8(byte[] bytes)
Constructs a new
String by decoding the specified array of bytes using the UTF-8 charset. |
public static byte[] getBytesUtf8(java.lang.String string)
string
- the String to encode, may be null
null
if the input string was null
public static java.lang.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 java.lang.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-2018 Apache Software Foundation. All Rights Reserved.