org.eclipse.jetty.util
类 TypeUtil

java.lang.Object
  继承者 org.eclipse.jetty.util.TypeUtil

public class TypeUtil
extends Object

TYPE Utilities. Provides various static utiltiy methods for manipulating types and their string representations.

从以下版本开始:
Jetty 4.1

字段摘要
static int CR
           
static int LF
           
 
构造方法摘要
TypeUtil()
           
 
方法摘要
static
<T> List<T>
asList(T[] a)
          Array to List.
static Object call(Class<?> oClass, String method, Object obj, Object[] arg)
           
static byte convertHexDigit(byte c)
           
static int convertHexDigit(int c)
           
static void dump(Class<?> c)
           
static void dump(ClassLoader cl)
           
static byte[] fromHexString(String s)
           
static Class<?> fromName(String name)
          Class from a canonical name for a type.
static URL jarFor(String className)
           
static byte[] parseBytes(String s, int base)
           
static int parseInt(byte[] b, int offset, int length, int base)
          Parse an int from a byte array of ascii characters.
static int parseInt(String s, int offset, int length, int base)
          Parse an int from a substring.
static byte[] readLine(InputStream in)
          已过时。  
static void toHex(byte b, Appendable buf)
           
static void toHex(int value, Appendable buf)
           
static void toHex(long value, Appendable buf)
           
static String toHexString(byte b)
           
static String toHexString(byte[] b)
           
static String toHexString(byte[] b, int offset, int length)
           
static String toName(Class<?> type)
          Canonical name for a type.
static String toString(byte[] bytes, int base)
           
static Object valueOf(Class<?> type, String value)
          Convert String value to instance.
static Object valueOf(String type, String value)
          Convert String value to instance.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

CR

public static int CR

LF

public static int LF
构造方法详细信息

TypeUtil

public TypeUtil()
方法详细信息

asList

public static <T> List<T> asList(T[] a)
Array to List.

Works like Arrays.asList(Object...), but handles null arrays.

返回:
a list backed by the array.

fromName

public static Class<?> fromName(String name)
Class from a canonical name for a type.

参数:
name - A class or type name.
返回:
A class , which may be a primitive TYPE field..

toName

public static String toName(Class<?> type)
Canonical name for a type.

参数:
type - A class , which may be a primitive TYPE field.
返回:
Canonical name.

valueOf

public static Object valueOf(Class<?> type,
                             String value)
Convert String value to instance.

参数:
type - The class of the instance, which may be a primitive TYPE field.
value - The value as a string.
返回:
The value as an Object.

valueOf

public static Object valueOf(String type,
                             String value)
Convert String value to instance.

参数:
type - classname or type (eg int)
value - The value as a string.
返回:
The value as an Object.

parseInt

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

参数:
s - String
offset - Offset within string
length - Length of integer or -1 for remainder of string
base - base of the integer
返回:
the parsed integer
抛出:
NumberFormatException - if the string cannot be parsed

parseInt

public static int parseInt(byte[] b,
                           int offset,
                           int length,
                           int base)
                    throws NumberFormatException
Parse an int from a byte array of ascii characters. Negative numbers are not handled.

参数:
b - byte array
offset - Offset within string
length - Length of integer or -1 for remainder of string
base - base of the integer
返回:
the parsed integer
抛出:
NumberFormatException - if the array cannot be parsed into an integer

parseBytes

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

toString

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

convertHexDigit

public static byte convertHexDigit(byte c)
参数:
c - An ASCII encoded character 0-9 a-f A-F
返回:
The byte value of the character 0-16.

convertHexDigit

public static int convertHexDigit(int c)
参数:
c - An ASCII encoded character 0-9 a-f A-F
返回:
The byte value of the character 0-16.

toHex

public static void toHex(byte b,
                         Appendable buf)

toHex

public static void toHex(int value,
                         Appendable buf)
                  throws IOException
抛出:
IOException

toHex

public static void toHex(long value,
                         Appendable buf)
                  throws IOException
抛出:
IOException

toHexString

public static String toHexString(byte b)

toHexString

public static String toHexString(byte[] b)

toHexString

public static String toHexString(byte[] b,
                                 int offset,
                                 int length)

fromHexString

public static byte[] fromHexString(String s)

dump

public static void dump(Class<?> c)

dump

public static void dump(ClassLoader cl)

readLine

public static byte[] readLine(InputStream in)
                       throws IOException
已过时。 

抛出:
IOException

jarFor

public static URL jarFor(String className)

call

public static Object call(Class<?> oClass,
                          String method,
                          Object obj,
                          Object[] arg)
                   throws InvocationTargetException,
                          NoSuchMethodException
抛出:
InvocationTargetException
NoSuchMethodException


Copyright © 2013. All Rights Reserved.