|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.portal.common.util.Tools
public class Tools
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
|
static java.util.ResourceBundle |
EMPTY_BUNDLE
|
static java.util.Enumeration |
EMPTY_ENUMERATION
|
static java.util.Iterator |
EMPTY_ITERATOR
|
static Logger |
log
|
static java.lang.String |
VMID
16 chars long VMID. |
Constructor Summary | |
---|---|
Tools()
|
Method Summary | |
---|---|
static java.lang.Object[] |
appendTo(java.lang.Object[] array,
java.lang.Object o)
Append an object to an array of objects. |
static java.lang.String |
buildClassLoaderInfo(java.lang.ClassLoader loader)
|
static int |
computeStringHash(int hash,
java.lang.String s)
|
static boolean |
confirmTemporaryHash(java.lang.String hash,
java.lang.String value,
long time)
|
static java.lang.String |
dumpClassLoaderHierarchyInfo(java.lang.ClassLoader loader)
|
static void |
dumpClassLoaderHierarchyInfo(Logger log,
Level level,
java.lang.ClassLoader loader)
|
static void |
dumpClassLoaderHierarchyInfo(java.io.Writer writer,
java.lang.ClassLoader loader)
|
static byte[] |
fromHexString(java.lang.String hex)
Returns a byte array converted from the hexadecimal format. |
static java.lang.String |
generateTemporaryHash(java.lang.String value,
long time)
|
static java.lang.String |
getPackageOf(java.lang.Class clazz)
|
static java.lang.String |
getShortNameOf(java.lang.Class clazz)
|
static java.lang.String |
hashAndEncodeString(java.lang.String text,
java.lang.String algorithm,
java.lang.String encoding)
Computes a hash with specified algorighm and returns the result as a string in hexadecimal format |
static boolean |
isContainedIn(java.lang.Object value,
java.lang.Object[] array)
Determines if value is contained in array. |
static java.util.Iterator |
iterator(java.lang.Object o)
Returns a singleton iterator. |
static java.util.Iterator |
iterator(java.lang.Object[] objects)
Returns an iterator over the array elements. |
static java.util.Iterator |
iterator(java.lang.Object[] objects,
int from,
int to)
Returns an iterator over the array elements within the specified range. |
static byte[] |
md5(java.lang.String text)
Computes an md5 hash of a string. |
static java.lang.String |
md5AsHexString(java.lang.String text)
Computes an md5 hash and returns the result as a string in hexadecimal format. |
static java.lang.String |
replace(java.lang.String string,
java.lang.String pattern,
java.lang.String replacement)
Replace occurence in a string. |
static java.lang.String |
replaceAllInstancesOfBoundedString(java.lang.String initial,
java.lang.String prefix,
java.lang.String suffix,
java.lang.String replacement)
|
static java.lang.String |
replaceBoundedString(java.lang.String initial,
java.lang.String prefix,
java.lang.String suffix,
java.lang.String replacement,
boolean replaceIfBoundedStringEmpty,
boolean keepBoundaries)
|
static boolean |
safeEquals(java.lang.Object o1,
java.lang.Object o2)
Return true if o1 is null and o2 is nullequals(Object o) on o1 wit o2 as argument returns true |
static java.lang.Object[] |
toArray(java.util.Iterator i)
|
static java.util.Enumeration |
toEnumeration(java.util.Iterator iterator)
|
static java.util.Enumeration |
toEnumeration(java.lang.Object o)
|
static java.util.Enumeration |
toEnumeration(java.lang.Object[] objects)
|
static java.lang.String |
toHexString(byte[] bytes)
Returns a string in the hexadecimal format. |
static java.util.List |
toList(java.util.Enumeration e)
|
static java.util.List |
toList(java.util.Iterator iterator)
|
static java.util.List |
toList(java.lang.Object[] objects)
|
static java.util.Set |
toSet(java.util.Enumeration e)
|
static java.util.Set |
toSet(java.util.Iterator iterator)
|
static java.util.Set |
toSet(java.lang.Object[] objects)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUFFER_SIZE
public static final Logger log
public static final java.lang.String VMID
public static final java.util.Enumeration EMPTY_ENUMERATION
public static final java.util.Iterator EMPTY_ITERATOR
public static final java.util.ResourceBundle EMPTY_BUNDLE
Constructor Detail |
---|
public Tools()
Method Detail |
---|
public static java.util.Enumeration toEnumeration(java.util.Iterator iterator)
public static java.util.Enumeration toEnumeration(java.lang.Object[] objects)
public static java.util.Enumeration toEnumeration(java.lang.Object o)
public static java.util.Set toSet(java.util.Enumeration e)
public static java.lang.Object[] toArray(java.util.Iterator i)
public static java.util.List toList(java.util.Enumeration e)
public static java.util.Set toSet(java.lang.Object[] objects)
public static java.util.Set toSet(java.util.Iterator iterator)
public static java.util.List toList(java.lang.Object[] objects)
public static java.util.List toList(java.util.Iterator iterator)
public static java.util.Iterator iterator(java.lang.Object o)
o
- the singleton object
public static java.util.Iterator iterator(java.lang.Object[] objects) throws java.lang.IllegalArgumentException
objects
- the array containing the objects to iterate on
java.lang.IllegalArgumentException
- if the object array is null or the specified range is not validpublic static java.util.Iterator iterator(java.lang.Object[] objects, int from, int to) throws java.lang.IllegalArgumentException
objects
- the array containing the objects to iterate onfrom
- the inclusive start indexto
- the exclusive stop index
java.lang.IllegalArgumentException
- if the object array is null or the specified range is not validpublic static int computeStringHash(int hash, java.lang.String s)
public static byte[] md5(java.lang.String text)
text
- the hashed string
java.lang.NullPointerException
- if text is nullpublic static java.lang.String md5AsHexString(java.lang.String text)
text
- the hashed string
java.lang.NullPointerException
- if text is nullpublic static java.lang.String hashAndEncodeString(java.lang.String text, java.lang.String algorithm, java.lang.String encoding) throws java.security.NoSuchAlgorithmException
text
- algorithm
- encoding
-
java.security.NoSuchAlgorithmException
public static java.lang.String toHexString(byte[] bytes)
bytes
- the converted bytes
java.lang.IllegalArgumentException
- if the byte array is nullpublic static byte[] fromHexString(java.lang.String hex)
hex
- the string to convert
java.lang.IllegalArgumentException
- if the string is null or does not have the good formatpublic static java.lang.String generateTemporaryHash(java.lang.String value, long time)
public static boolean confirmTemporaryHash(java.lang.String hash, java.lang.String value, long time)
public static java.lang.String getShortNameOf(java.lang.Class clazz)
public static java.lang.String getPackageOf(java.lang.Class clazz)
public static java.lang.String buildClassLoaderInfo(java.lang.ClassLoader loader)
public static java.lang.String dumpClassLoaderHierarchyInfo(java.lang.ClassLoader loader)
public static void dumpClassLoaderHierarchyInfo(java.io.Writer writer, java.lang.ClassLoader loader)
public static void dumpClassLoaderHierarchyInfo(Logger log, Level level, java.lang.ClassLoader loader)
public static java.lang.String replace(java.lang.String string, java.lang.String pattern, java.lang.String replacement)
string
- the source stringpattern
- the replaced patternreplacement
- the replacement text
public static java.lang.Object[] appendTo(java.lang.Object[] array, java.lang.Object o) throws java.lang.IllegalArgumentException, java.lang.ClassCastException
array
- the array to augmento
- the object to append
java.lang.IllegalArgumentException
- if the array is null
java.lang.ClassCastException
- if the appended object class prevents it from being added to the arraypublic static boolean safeEquals(java.lang.Object o1, java.lang.Object o2)
equals(Object o)
on o1 wit o2 as argument returns true
o1
- the first argumento2
- the second argument
public static java.lang.String replaceAllInstancesOfBoundedString(java.lang.String initial, java.lang.String prefix, java.lang.String suffix, java.lang.String replacement)
public static java.lang.String replaceBoundedString(java.lang.String initial, java.lang.String prefix, java.lang.String suffix, java.lang.String replacement, boolean replaceIfBoundedStringEmpty, boolean keepBoundaries)
public static boolean isContainedIn(java.lang.Object value, java.lang.Object[] array)
value
- array
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |