java.lang.Object
org.glassfish.grizzly.http.util.Ascii
This class implements some basic ASCII character handling functions.
- Author:
- dac@eng.sun.com, James Todd [gonzo@eng.sun.com]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidintToHexString(org.glassfish.grizzly.Buffer buffer, int i) static voidintToUnsignedString(org.glassfish.grizzly.Buffer buffer, int value, int shift) Convert the integer to an unsigned number.static booleanisAlpha(int c) Returns true if the specified ASCII character is upper or lower case.static booleanisDigit(int c) Returns true if the specified ASCII character is a digit.static booleanisLower(int c) Returns true if the specified ASCII character is lower case.static booleanisUpper(int c) Returns true if the specified ASCII character is upper case.static booleanisWhite(int c) Returns true if the specified ASCII character is white space.static intparseInt(byte[] b, int off, int len) Parses an unsigned integer from the specified sub-array of bytes.static intparseInt(char[] b, int off, int len) static intstatic intparseInt(org.glassfish.grizzly.Buffer b, int off, int len) Parses an unsigned int from the specified sub-array of bytes.static intParses an unsigned integer from the specifiedDataChunk.static intParses an unsigned integer from the specified part ofDataChunk.static longparseLong(byte[] b, int off, int len) Parses an unsigned long from the specified sub-array of bytes.static longparseLong(char[] b, int off, int len) static longstatic longparseLong(org.glassfish.grizzly.Buffer b, int off, int len) Parses an unsigned long from the specified sub-array of bytes.static longstatic longstatic voidtoLower(byte[] bytes) Converts passed bytes (representing ASCII characters) to the lower case equivalent.static inttoLower(int c) Returns the lower case equivalent of the specified ASCII character.static voidtoUpper(byte[] bytes) Converts passed bytes (representing ASCII characters) to the upper case equivalent.static inttoUpper(int c) Returns the upper case equivalent of the specified ASCII character.
-
Constructor Details
-
Ascii
public Ascii()
-
-
Method Details
-
toUpper
public static int toUpper(int c) Returns the upper case equivalent of the specified ASCII character. -
toUpper
public static void toUpper(byte[] bytes) Converts passed bytes (representing ASCII characters) to the upper case equivalent. -
toLower
public static int toLower(int c) Returns the lower case equivalent of the specified ASCII character. -
toLower
public static void toLower(byte[] bytes) Converts passed bytes (representing ASCII characters) to the lower case equivalent. -
isAlpha
public static boolean isAlpha(int c) Returns true if the specified ASCII character is upper or lower case. -
isUpper
public static boolean isUpper(int c) Returns true if the specified ASCII character is upper case. -
isLower
public static boolean isLower(int c) Returns true if the specified ASCII character is lower case. -
isWhite
public static boolean isWhite(int c) Returns true if the specified ASCII character is white space. -
isDigit
public static boolean isDigit(int c) Returns true if the specified ASCII character is a digit. -
parseInt
Parses an unsigned integer from the specifiedDataChunk.- Parameters:
dataChunk- theDataChunk- Throws:
NumberFormatException- if the integer format was invalid
-
parseInt
Parses an unsigned integer from the specified part ofDataChunk.- Parameters:
dataChunk- theDataChunkoffset- the start offsetlength- the length- Throws:
NumberFormatException- if the integer format was invalid
-
parseInt
Parses an unsigned integer from the specified sub-array of bytes.- Parameters:
b- the bytes to parseoff- the start offset of the byteslen- the length of the bytes- Throws:
NumberFormatException- if the integer format was invalid
-
parseInt
- Throws:
NumberFormatException
-
parseInt
public static int parseInt(org.glassfish.grizzly.Buffer b, int off, int len) throws NumberFormatException Parses an unsigned int from the specified sub-array of bytes.- Parameters:
b- the Buffer to parseoff- the start offset of the byteslen- the length of the bytes- Throws:
NumberFormatException- if the long format was invalid
-
parseInt
- Throws:
NumberFormatException
-
parseLong
Parses an unsigned long from the specified sub-array of bytes.- Parameters:
b- the bytes to parseoff- the start offset of the byteslen- the length of the bytes- Throws:
NumberFormatException- if the long format was invalid
-
parseLong
- Throws:
NumberFormatException
-
parseLong
- Throws:
NumberFormatException
-
parseLong
public static long parseLong(org.glassfish.grizzly.Buffer b, int off, int len) throws NumberFormatException Parses an unsigned long from the specified sub-array of bytes.- Parameters:
b- the Buffer to parseoff- the start offset of the byteslen- the length of the bytes- Throws:
NumberFormatException- if the long format was invalid
-
parseLong
-
parseLong
-
intToHexString
public static void intToHexString(org.glassfish.grizzly.Buffer buffer, int i) -
intToUnsignedString
public static void intToUnsignedString(org.glassfish.grizzly.Buffer buffer, int value, int shift) Convert the integer to an unsigned number.
-