|
|||||||||
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 org.apache.log4j.Logger |
log
|
static java.lang.String |
VMID
16 chars long VMID. |
Constructor Summary | |
---|---|
Tools()
|
Method Summary | ||
---|---|---|
static
|
appendTo(E[] array,
E 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(org.apache.log4j.Logger log,
java.lang.ClassLoader loader)
|
|
static void |
dumpClassLoaderHierarchyInfo(org.apache.log4j.Logger log,
org.apache.log4j.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
|
iterator(E... objects)
Returns an iterator over the array elements. |
|
static
|
iterator(E o)
Returns a singleton iterator. |
|
static
|
iterator(E[] 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)
Todo : define what "bounded" means. |
|
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)
Deprecated. |
|
static
|
toEnumeration(E o)
|
|
static
|
toEnumeration(E[] objects)
|
|
static
|
toEnumeration(java.util.Iterator<E> iterator)
|
|
static java.lang.String |
toHexString(byte[] bytes)
Returns a string in the hexadecimal format. |
|
static
|
toList(E... objects)
|
|
static
|
toList(java.util.Enumeration<E> e)
|
|
static
|
toList(java.util.Iterator<E> iterator)
|
|
static
|
toSet(E... objects)
|
|
static
|
toSet(java.util.Enumeration<E> e)
|
|
static
|
toSet(java.util.Iterator<E> iterator)
Transforms an iterator into an unordered Set |
|
static
|
toSet(java.util.Iterator<E> iterator,
boolean preserveOrder)
Transforms an iterator into a Set |
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 org.apache.log4j.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 <E> java.util.Enumeration<E> toEnumeration(java.util.Iterator<E> iterator)
public static <E> java.util.Enumeration<E> toEnumeration(E[] objects)
public static <E> java.util.Enumeration<E> toEnumeration(E o)
public static <E> java.util.Set<E> toSet(java.util.Enumeration<E> e)
public static <E> java.util.Set<E> toSet(E... objects)
public static <E> java.util.Set<E> toSet(java.util.Iterator<E> iterator)
iterator
- The iterator to transform
public static <E> java.util.Set<E> toSet(java.util.Iterator<E> iterator, boolean preserveOrder)
iterator
- The iterator to transformpreserveOrder
- true if the set must respect the ordering of the iterator
public static <E> java.util.List<E> toList(java.util.Enumeration<E> e)
public static <E> java.util.List<E> toList(java.util.Iterator<E> iterator)
public static <E> java.util.List<E> toList(E... objects)
@Deprecated public static java.lang.Object[] toArray(java.util.Iterator i)
i
-
public static <E> java.util.Iterator<E> iterator(E o)
o
- the singleton object
public static <E> java.util.Iterator<E> iterator(E... 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 <E> java.util.Iterator<E> iterator(E[] 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 valid or if the 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(org.apache.log4j.Logger log, java.lang.ClassLoader loader)
public static void dumpClassLoaderHierarchyInfo(org.apache.log4j.Logger log, org.apache.log4j.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 <E> E[] appendTo(E[] array, E 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)
initial
- prefix
- suffix
- replacement
- replaceIfBoundedStringEmpty
- 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 |