Top Description Fields Constructors Methods
org.glassfish.grizzly.http.util

public final Class Ascii

extends Object
Class Inheritance
Imports
org.glassfish.grizzly.Buffer

This class implements some basic ASCII character handling functions.
Authors
[email protected], James Todd [[email protected]]

Field Summary

Modifier and TypeField and Description
pack-priv static final char[]
digits

All possible chars for representing a number as a String

private static final long
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
intToHexString(Buffer buffer, int i)

public static void
intToUnsignedString(Buffer buffer, int value, int shift)

Convert the integer to an unsigned number.

public static boolean
isAlpha(int c)

Returns true if the specified ASCII character is upper or lower case.

public static boolean
isDigit(int c)

Returns true if the specified ASCII character is a digit.

public static boolean
isLower(int c)

Returns true if the specified ASCII character is lower case.

public static boolean
isUpper(int c)

Returns true if the specified ASCII character is upper case.

public static boolean
isWhite(int c)

Returns true if the specified ASCII character is white space.

public static int
parseInt(final DataChunk dataChunk)

Parses an unsigned integer from the specified DataChunk.

public static int
parseInt(final DataChunk dataChunk, final int
the start offset
offset
,
final int
the length
length
)

Parses an unsigned integer from the specified part of DataChunk.

public static int
parseInt(byte[]
the bytes to parse
b
,
int
the start offset of the bytes
off
,
int
the length of the bytes
len
)

Parses an unsigned integer from the specified sub-array of bytes.

public static int
parseInt(char[] b, int off, int len)

public static int
parseInt(Buffer
the Buffer to parse
b
,
int
the start offset of the bytes
off
,
int
the length of the bytes
len
)

Parses an unsigned int from the specified sub-array of bytes.

public static int
parseInt(String s, int off, int len)

public static long
parseLong(byte[]
the bytes to parse
b
,
int
the start offset of the bytes
off
,
int
the length of the bytes
len
)

Parses an unsigned long from the specified sub-array of bytes.

public static long
parseLong(char[] b, int off, int len)

public static long
parseLong(String s, int off, int len)

public static long
parseLong(Buffer
the Buffer to parse
b
,
int
the start offset of the bytes
off
,
int
the length of the bytes
len
)

Parses an unsigned long from the specified sub-array of bytes.

public static long
parseLong(final DataChunk dataChunk)

public static long
parseLong(final DataChunk dataChunk, final int offset, final int length)

public static int
toLower(int c)

Returns the lower case equivalent of the specified ASCII character.

public static void
toLower(final byte[] bytes)

Converts passed bytes (representing ASCII characters) to the lower case equivalent.

public static int
toUpper(int c)

Returns the upper case equivalent of the specified ASCII character.

public static void
toUpper(final byte[] bytes)

Converts passed bytes (representing ASCII characters) to the upper case equivalent.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

digitsback to summary
pack-priv static final char[] digits

All possible chars for representing a number as a String

INT_OVERFLOW_LIMITback to summary
private static final long INT_OVERFLOW_LIMIT
LONG_OVERFLOW_LIMITback to summary
private static final long LONG_OVERFLOW_LIMIT

Constructor Detail

Asciiback to summary
public Ascii()

Method Detail

intToHexStringback to summary
public static void intToHexString(Buffer buffer, int i)
intToUnsignedStringback to summary
public static void intToUnsignedString(Buffer buffer, int value, int shift)

Convert the integer to an unsigned number.

isAlphaback to summary
public static boolean isAlpha(int c)

Returns true if the specified ASCII character is upper or lower case.

isDigitback to summary
public static boolean isDigit(int c)

Returns true if the specified ASCII character is a digit.

isLowerback to summary
public static boolean isLower(int c)

Returns true if the specified ASCII character is lower case.

isUpperback to summary
public static boolean isUpper(int c)

Returns true if the specified ASCII character is upper case.

isWhiteback to summary
public static boolean isWhite(int c)

Returns true if the specified ASCII character is white space.

parseIntback to summary
public static int parseInt(final DataChunk dataChunk)

Parses an unsigned integer from the specified DataChunk.

Parameters
dataChunk:DataChunk

the DataChunk

Exceptions
NumberFormatException:
if the integer format was invalid
parseIntback to summary
public static int parseInt(final DataChunk dataChunk, final int offset, final int length)

Parses an unsigned integer from the specified part of DataChunk.

Parameters
dataChunk:DataChunk

the DataChunk

offset:int

the start offset

length:int

the length

Exceptions
NumberFormatException:
if the integer format was invalid
parseIntback to summary
public static int parseInt(byte[] b, int off, int len) throws NumberFormatException

Parses an unsigned integer from the specified sub-array of bytes.

Parameters
b:byte[]

the bytes to parse

off:int

the start offset of the bytes

len:int

the length of the bytes

Exceptions
NumberFormatException:
if the integer format was invalid
parseIntback to summary
public static int parseInt(char[] b, int off, int len) throws NumberFormatException
parseIntback to summary
public static int parseInt(Buffer b, int off, int len) throws NumberFormatException

Parses an unsigned int from the specified sub-array of bytes.

Parameters
b:Buffer

the Buffer to parse

off:int

the start offset of the bytes

len:int

the length of the bytes

Exceptions
NumberFormatException:
if the long format was invalid
parseIntback to summary
public static int parseInt(String s, int off, int len) throws NumberFormatException
parseLongback to summary
public static long parseLong(byte[] b, int off, int len) throws NumberFormatException

Parses an unsigned long from the specified sub-array of bytes.

Parameters
b:byte[]

the bytes to parse

off:int

the start offset of the bytes

len:int

the length of the bytes

Exceptions
NumberFormatException:
if the long format was invalid
parseLongback to summary
public static long parseLong(char[] b, int off, int len) throws NumberFormatException
parseLongback to summary
public static long parseLong(String s, int off, int len) throws NumberFormatException
parseLongback to summary
public static long parseLong(Buffer b, int off, int len) throws NumberFormatException

Parses an unsigned long from the specified sub-array of bytes.

Parameters
b:Buffer

the Buffer to parse

off:int

the start offset of the bytes

len:int

the length of the bytes

Exceptions
NumberFormatException:
if the long format was invalid
parseLongback to summary
public static long parseLong(final DataChunk dataChunk)
parseLongback to summary
public static long parseLong(final DataChunk dataChunk, final int offset, final int length)
toLowerback to summary
public static int toLower(int c)

Returns the lower case equivalent of the specified ASCII character.

toLowerback to summary
public static void toLower(final byte[] bytes)

Converts passed bytes (representing ASCII characters) to the lower case equivalent.

toUpperback to summary
public static int toUpper(int c)

Returns the upper case equivalent of the specified ASCII character.

toUpperback to summary
public static void toUpper(final byte[] bytes)

Converts passed bytes (representing ASCII characters) to the upper case equivalent.