Methods Summary |
---|
public static boolean | isAlpha(int c)Returns true if the specified ASCII character is upper or lower case.
return isAlpha[c & 0xff];
|
public static boolean | isDigit(int c)Returns true if the specified ASCII character is a digit.
return isDigit[c & 0xff];
|
public static boolean | isLower(int c)Returns true if the specified ASCII character is lower case.
return isLower[c & 0xff];
|
public static boolean | isUpper(int c)Returns true if the specified ASCII character is upper case.
return isUpper[c & 0xff];
|
public static boolean | isWhite(int c)Returns true if the specified ASCII character is white space.
return isWhite[c & 0xff];
|
public static int | parseInt(byte[] b, int off, int len)Parses an unsigned integer from the specified subarray of bytes.
int c;
if (b == null || len <= 0 || !isDigit(c = b[off++])) {
throw new NumberFormatException();
}
int n = c - '0";
while (--len > 0) {
if (!isDigit(c = b[off++])) {
throw new NumberFormatException();
}
n = n * 10 + c - '0";
}
return n;
|
public static int | parseInt(char[] b, int off, int len)
int c;
if (b == null || len <= 0 || !isDigit(c = b[off++])) {
throw new NumberFormatException();
}
int n = c - '0";
while (--len > 0) {
if (!isDigit(c = b[off++])) {
throw new NumberFormatException();
}
n = n * 10 + c - '0";
}
return n;
|
public static long | parseLong(byte[] b, int off, int len)Parses an unsigned long from the specified subarray of bytes.
int c;
if (b == null || len <= 0 || !isDigit(c = b[off++])) {
throw new NumberFormatException();
}
long n = c - '0";
long m;
while (--len > 0) {
if (!isDigit(c = b[off++])) {
throw new NumberFormatException();
}
m = n * 10 + c - '0";
if (m < n) {
// Overflow
throw new NumberFormatException();
} else {
n = m;
}
}
return n;
|
public static long | parseLong(char[] b, int off, int len)
int c;
if (b == null || len <= 0 || !isDigit(c = b[off++])) {
throw new NumberFormatException();
}
long n = c - '0";
long m;
while (--len > 0) {
if (!isDigit(c = b[off++])) {
throw new NumberFormatException();
}
m = n * 10 + c - '0";
if (m < n) {
// Overflow
throw new NumberFormatException();
} else {
n = m;
}
}
return n;
|
public static int | toLower(int c)Returns the lower case equivalent of the specified ASCII character.
return toLower[c & 0xff] & 0xff;
|
public static int | toUpper(int c)Returns the upper case equivalent of the specified ASCII character.
/*
* Initialize character translation and type tables.
*/
for (int i = 0; i < 256; i++) {
toUpper[i] = (byte)i;
toLower[i] = (byte)i;
}
for (int lc = 'a"; lc <= 'z"; lc++) {
int uc = lc + 'A" - 'a";
toUpper[lc] = (byte)uc;
toLower[uc] = (byte)lc;
isAlpha[lc] = true;
isAlpha[uc] = true;
isLower[lc] = true;
isUpper[uc] = true;
}
isWhite[ ' "] = true;
isWhite['\t"] = true;
isWhite['\r"] = true;
isWhite['\n"] = true;
isWhite['\f"] = true;
isWhite['\b"] = true;
for (int d = '0"; d <= '9"; d++) {
isDigit[d] = true;
}
return toUpper[c & 0xff] & 0xff;
|