|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.api.client.util.StringUtils
public class StringUtils
Utilities for strings.
Some of these methods are a proxy for version 1.6 (or newer) of the Apache Commons Codec
StringUtils
implementation. This is needed in order to support platforms like Android
which already include an older version of the Apache Commons Codec (Android includes version
1.3). To avoid a dependency library conflict, this library includes a reduced private copy of
version 1.6 (or newer) of the Apache Commons Codec (using a tool like jarjar).
Field Summary | |
---|---|
static String |
LINE_SEPARATOR
Line separator to use for this OS, i.e. |
Method Summary | |
---|---|
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 |
newStringUtf8(byte[] bytes)
Constructs a new String by decoding the specified array of bytes using the UTF-8
charset. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String LINE_SEPARATOR
"\n"
or "\r\n"
.
Method Detail |
---|
public static byte[] getBytesUtf8(String string)
string
- the String to encode, may be null
null
if the input string was null
IllegalStateException
- Thrown when the charset is missing, which should be never
according the the Java specification.org.apache.commons.codec.binary.StringUtils#getBytesUtf8(String)
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 characters
String
decoded from the specified array of bytes using the UTF-8
charset, or null
if the input byte array was null
.
IllegalStateException
- Thrown when a UnsupportedEncodingException
is caught,
which should never happen since the charset is required.org.apache.commons.codec.binary.StringUtils#newStringUtf8(byte[])
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |