public class TextUtils extends Object
Constructor and Description |
---|
TextUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
digitValue(char c)
Interpret a character as a digit (in any base up to 36) and return the
numeric value.
|
static String |
escapeBytes(com.google.protobuf.ByteString input)
Escapes bytes in the format used in protocol buffer text format, which is the same as the
format used for C string literals.
|
static boolean |
isDigits(String text) |
static boolean |
isHex(char c)
Is this a hex digit?
|
static boolean |
isOctal(char c)
Is this an octal digit?
|
static boolean |
parseBoolean(String text)
Parse a boolean and return its value.
|
static double |
parseDouble(String text)
If the next token is a double and return its value.
|
static float |
parseFloat(String text)
Parse a float and return its value.
|
static int |
parseInt32(String text)
Parse a 32-bit signed integer from the text.
|
static long |
parseInt64(String text)
Parse a 64-bit signed integer from the text.
|
static long |
parseInteger(String text,
boolean isSigned,
boolean isLong) |
static int |
parseUInt32(String text)
Parse a 32-bit unsigned integer from the text.
|
static long |
parseUInt64(String text)
Parse a 64-bit unsigned integer from the text.
|
static InputStream |
toInputStream(String input) |
static InputStream |
toInputStream(String input,
Charset cs) |
static StringBuilder |
toStringBuilder(Readable input) |
static com.google.protobuf.ByteString |
unescapeBytes(CharSequence charString)
Un-escape a byte sequence as escaped using
escapeBytes(ByteString) . |
static BigInteger |
unsignedLong(long value)
Convert an unsigned 64-bit integer to a
BigInteger . |
static String |
unsignedToString(int value)
Convert an unsigned 32-bit integer to a string.
|
static String |
unsignedToString(long value)
Convert an unsigned 64-bit integer to a string.
|
public static String unsignedToString(long value)
public static String unsignedToString(int value)
public static BigInteger unsignedLong(long value)
BigInteger
.public static boolean isHex(char c)
public static boolean isOctal(char c)
public static int digitValue(char c)
Character.digit()
but we don't accept
non-ASCII digits.public static boolean isDigits(String text)
public static StringBuilder toStringBuilder(Readable input) throws IOException
IOException
public static InputStream toInputStream(String input)
public static InputStream toInputStream(String input, Charset cs)
public static double parseDouble(String text) throws NumberFormatException
NumberFormatException
.NumberFormatException
public static float parseFloat(String text) throws NumberFormatException
NumberFormatException
.NumberFormatException
public static boolean parseBoolean(String text) throws IllegalArgumentException
IllegalArgumentException
.IllegalArgumentException
public static int parseInt32(String text) throws NumberFormatException
Integer.parseInt()
, this function recognizes the prefixes "0x"
and "0" to signify hexidecimal and octal numbers, respectively.NumberFormatException
public static int parseUInt32(String text) throws NumberFormatException
Integer.parseInt()
, this function recognizes the prefixes "0x"
and "0" to signify hexidecimal and octal numbers, respectively. The
result is coerced to a (signed) int
when returned since Java has
no unsigned integer type.NumberFormatException
public static long parseInt64(String text) throws NumberFormatException
Integer.parseInt()
, this function recognizes the prefixes "0x"
and "0" to signify hexidecimal and octal numbers, respectively.NumberFormatException
public static long parseUInt64(String text) throws NumberFormatException
Integer.parseInt()
, this function recognizes the prefixes "0x"
and "0" to signify hexidecimal and octal numbers, respectively. The
result is coerced to a (signed) long
when returned since Java has
no unsigned long type.NumberFormatException
public static long parseInteger(String text, boolean isSigned, boolean isLong) throws NumberFormatException
NumberFormatException
public static String escapeBytes(com.google.protobuf.ByteString input)
public static com.google.protobuf.ByteString unescapeBytes(CharSequence charString)
escapeBytes(ByteString)
. Two-digit hex escapes (starting with
"\x") are also recognized.Copyright © 2017. All rights reserved.