org.mortbay.util
Class TypeUtil

java.lang.Object
  |
  +--org.mortbay.util.TypeUtil

public class TypeUtil
extends java.lang.Object

TYPE Utilities Provides a cache for basic Types. The cache size can be controlled with the "org.mortbay.util.TypeUtil.IntegerCacheSize" property.

Since:
Jetty 4.1
Version:
$Revision: 1.6 $
Author:
Greg Wilkins (gregw)

Constructor Summary
TypeUtil()
           
 
Method Summary
static byte convertHexDigit(byte b)
           
static byte[] fromHexString(java.lang.String s)
           
static java.lang.Integer newInteger(int i)
          Convert int to Integer using cache.
static byte[] parseBytes(java.lang.String s, int base)
           
static int parseInt(java.lang.String s, int offset, int length, int base)
          Parse an int from a substring.
static java.lang.String toHexString(byte[] b)
           
static java.lang.String toString(byte[] bytes, int base)
           
static java.lang.String toString(int i)
          Convert int to String using cache.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeUtil

public TypeUtil()
Method Detail

newInteger

public static java.lang.Integer newInteger(int i)
Convert int to Integer using cache.


toString

public static java.lang.String toString(int i)
Convert int to String using cache.


parseInt

public static int parseInt(java.lang.String s,
                           int offset,
                           int length,
                           int base)
                    throws java.lang.NumberFormatException
Parse an int from a substring. Negative numbers are not handled.

Parameters:
s - String
offset - Offset within string
length - Length of integer or -1 for remainder of string
base - base of the integer
Throws:
java.lang.NumberFormatException

parseBytes

public static byte[] parseBytes(java.lang.String s,
                                int base)

toString

public static java.lang.String toString(byte[] bytes,
                                        int base)

convertHexDigit

public static byte convertHexDigit(byte b)
Parameters:
b - An ASCII encoded character 0-9 a-f A-F
Returns:
The byte value of the character 0-16.

toHexString

public static java.lang.String toHexString(byte[] b)

fromHexString

public static byte[] fromHexString(java.lang.String s)


Copyright ? 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.