public final class ASCII extends Object
chars and
Strings.| Modifier and Type | Method and Description |
|---|---|
static boolean |
canDecode(byte... input)
Returns whether the given byte array represents valid ASCII encoded
characters.
|
static boolean |
canDecode(byte[] input,
int off,
int len)
Returns whether the specified range in the given byte array represents
valid ASCII encoded characters.
|
static boolean |
canEncode(String str)
Returns whether the given
String can be encoded into ASCII. |
static boolean |
canEncode(String str,
int off,
int len)
Returns whether the specified range in the given
String can
be encoded into ASCII. |
static String |
capitalize(String str)
Returns a
String built from the given one by upper-casing its
first character (other characters are copied unchanged). |
static String |
decode(byte... input)
Decodes the given ASCII encoded characters.
|
static String |
decode(byte[] input,
int off,
int len)
Decodes
len ASCII encoded bytes from the given input buffer,
starting at off. |
static byte[] |
encode(String str)
Returns the ASCII encoding of the given
String. |
static byte[] |
encode(String str,
int off,
int len)
Returns the ASCII encoding of the specified character sequence.
|
static boolean |
isAlphabetic(String str)
Returns whether the given
String is an alphabetic sequence,
that is, a sequence which only contains letters. |
static boolean |
isAlphaNumeric(String str)
Returns whether the given
String is an alphanumeric sequence,
that is, a sequence which only contains letters and digits. |
static boolean |
isDigit(char c)
Returns whether the given character represents a digit.
|
static boolean |
isLetter(char c)
Returns whether the given character is a letter.
|
static boolean |
isLowerCase(char c)
Returns whether the given character is one of the lowercase ASCII
characters between 'a' and 'z' (inclusive).
|
static boolean |
isNumeric(String str)
Returns whether the given
String is a numeric sequence, that
is, a sequence which only contains digits. |
static boolean |
isPrintable(char c)
Returns whether the given character is one of the 95 printable ASCII
characters.
|
static boolean |
isUpperCase(char c)
Returns whether the given character is one of the uppercase ASCII
characters between 'A' and 'Z' (inclusive).
|
static char |
toLowerCase(char c)
Returns the lowercase equivalent of the given character.
|
static String |
toLowerCase(String str)
Returns a
String in which all uppercase ASCII characters have
been replaced by their lowercase equivalent (all other characters are
unchanged). |
static char |
toUpperCase(char c)
Returns the uppercase equivalent of the given character.
|
static String |
toUpperCase(String str)
Returns a
String in which all lowercase ASCII characters have
been replaced by their uppercase equivalent (all other characters are
unchanged). |
public static boolean canEncode(String str)
String can be encoded into ASCII.str - the String to test.str can be encoded into ASCII.NullPointerException - if str is null.public static boolean canEncode(String str, int off, int len)
String can
be encoded into ASCII.str - the input String.off - the start index, inclusive.len - the number of characters to test.str can be encoded
into ASCII.NullPointerException - if str is null.IndexOutOfBoundsException - if off or len is
negative or if off + len is greater than str's
length.public static boolean canDecode(byte... input)
input - the bytes to test.input repesents ASCII encoded characters.NullPointerException - if input is null.public static boolean canDecode(byte[] input,
int off,
int len)
input - the input buffer.off - the start index, inclusive.len - the number of bytes to test.input represents ASCII
encoded characters.NullPointerException - if input is null.IndexOutOfBoundsException - if off or len is
negative or if off + len is greater than input's
length.public static byte[] encode(String str)
String.str - the String to encode.String.NullPointerException - if str is null.IllegalArgumentException - if str can't be encoded into
ASCII.public static byte[] encode(String str, int off, int len)
str - the input String.off - the start index, inclusive.len - the number of characters to encode.NullPointerException - if str is null.IndexOutOfBoundsException - if off or len is
negative or if off + len is greater than str's
length.IllegalArgumentException - if the specified characters can't be
encoded into ASCII.public static String decode(byte... input)
input - the ASCII encoded characters to decode.NullPointerException - if input is null.IllegalArgumentException - if input doesn't represent
valid ASCII encoded characters.public static String decode(byte[] input, int off, int len)
len ASCII encoded bytes from the given input buffer,
starting at off.input - the input buffer.off - the starting offset.len - the number of bytes to decode.NullPointerException - if input is null.IndexOutOfBoundsException - if off or len is
negative or if off + len is greater than input's
length.IllegalArgumentException - if the specified bytes do not
represent valid ASCII encoded characters.public static boolean isPrintable(char c)
c - the character to test.public static boolean isDigit(char c)
c - the character to test.public static boolean isLetter(char c)
c - the character to test.public static boolean isAlphabetic(String str)
String is an alphabetic sequence,
that is, a sequence which only contains letters.str - the String to test.String is an alphabetic sequence.NullPointerException - if str is null.public static boolean isNumeric(String str)
String is a numeric sequence, that
is, a sequence which only contains digits.str - the String to test.String is a numeric sequence.NullPointerException - if str is null.public static boolean isAlphaNumeric(String str)
String is an alphanumeric sequence,
that is, a sequence which only contains letters and digits.str - the String to test.String is an alphanumeric sequence.NullPointerException - if str is null.public static boolean isLowerCase(char c)
c - the character to test.public static boolean isUpperCase(char c)
c - the character to test.public static char toLowerCase(char c)
c - the character to transform lowercase.public static char toUpperCase(char c)
c - the character to transform uppercase.public static String toLowerCase(String str)
String in which all uppercase ASCII characters have
been replaced by their lowercase equivalent (all other characters are
unchanged).str - the String to convert into lowercase.String.NullPointerException - if str is null.public static String toUpperCase(String str)
String in which all lowercase ASCII characters have
been replaced by their uppercase equivalent (all other characters are
unchanged).str - the String to convert into uppercase.String.NullPointerException - if str is null.public static String capitalize(String str)
String built from the given one by upper-casing its
first character (other characters are copied unchanged).str - the String to capitalize.String.NullPointerException - if str is null.Copyright © 2012–2015. All rights reserved.