|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jalios.util.Util
public class Util
This class provides a set of static methods which perform various utility operations.
| Field Summary | |
|---|---|
static java.util.HashMap |
basicEntitiesDecodingMap
|
static java.util.HashMap |
basicEntitiesEncodingMap
|
static java.util.HashMap<java.lang.String,java.lang.String> |
cookieTransTable
|
static java.util.TreeSet |
EMPTY_TREESET
The empty TreeSet (immutable). |
static char |
ESCAPE_CHAR
|
protected static org.apache.oro.text.regex.Perl5Compiler |
hexaPercentCompiler
|
protected static org.apache.oro.text.regex.Pattern |
hexaPercentPattern
|
protected static org.apache.oro.text.regex.Perl5Substitution |
hexaPercentSubst
|
static java.util.HashMap<java.lang.String,java.lang.String> |
isoLatin1_xml
|
static java.util.HashMap<java.lang.String,java.lang.String> |
regexpEscaped1
|
static java.util.HashMap<java.lang.String,java.lang.String> |
regexpEscaped2
|
static java.util.HashMap<java.lang.String,java.lang.String> |
regexpEscaped3
|
static java.lang.String |
REVISION
|
| Method Summary | ||
|---|---|---|
static
|
addAll(java.util.Collection<T> collection,
java.util.Enumeration<T> enu)
Add all element of the enumerate to the collection return the collection modified. |
|
static
|
addAll(java.util.Collection<T> collection,
java.util.Iterator<T> it)
Add all element of the iterator to the collection return the collection modified. |
|
static
|
addAll(T[] array,
java.util.Collection<T> coll)
Copy all non-null objects from the given array to given collection. |
|
static
|
addInMapHashSet(java.util.Map<K,java.util.Set<V>> map,
K key,
V value)
A convenient method that add the given value to a set bound to the given key in the given map. |
|
static
|
addInMapLinkedHashSet(java.util.Map<K,java.util.LinkedHashSet<V>> map,
K key,
V value)
A convenient method that add the given value to a set bound to the given key in the given map. |
|
static boolean |
arrayContains(java.lang.Object[] array,
java.lang.Object key)
Test if an array contains a given object. |
|
static java.lang.String |
asciiIndent(java.lang.String text,
int cols,
int rows,
java.lang.String tailString)
Indent a given text according a number of column and row. |
|
static java.lang.String |
buildCamelID(java.lang.String str)
Build a Camel Case ID from the given String: remove the blanks, unaccentuates, removes non-alphanum chars. |
|
static java.lang.String |
buildID(java.lang.String str)
Build an ID from the given String: replaces the blanks with '_', unaccentuates, removes non-alphanum chars and lowercases. |
|
static java.lang.String |
buildID(java.lang.String str,
java.lang.String charRange)
Build an ID from the given String: replaces the blanks with '_', unaccentuates, removes chars out of the given range and lowercases. |
|
static java.lang.String |
buildUID(java.lang.String str,
java.util.Set<java.lang.String> strSet)
Build an ID from the given String: replaces the blanks with '_', unaccentuates, removes non-alphanum chars and lowercases. |
|
static
|
cleanCollection(java.util.Collection<T> coll)
Remove the null entries of the given collection. |
|
static java.lang.Object[] |
cleanObjectArray(java.lang.Object[] array)
Creates a new array that contains all elements of the given array without null. |
|
static java.lang.String[] |
cleanStringArray(java.lang.String[] array)
Creates a new array that contains all elements of the given array except empty Strings (ie null or empty). |
|
static
|
collectionToCleanSet(java.util.Collection<T> coll)
Returns a set which contains all the non empty element of the given collection. |
|
static
|
compareMap(java.util.Map<K,V> map1,
java.util.Map<K,V> map2)
Returns the first common Map.Entry of the given maps. |
|
static java.lang.String |
conceal(java.lang.String clearStr)
Conceal the given string with an internally choosen encryption algorithm. |
|
static java.lang.String |
cryptMD5(java.lang.String str)
Encrypt the given string with the MD5 algorithm and BASE64 |
|
static java.lang.String |
cryptUnix(java.lang.String str)
Encrypt the given string with the Unix crypt algorithm |
|
static java.lang.String |
decodeBASE64(java.lang.String str)
Decode the given string using BASE64 algorithm |
|
static java.lang.String |
decodeCookie(java.lang.String src)
|
|
static java.lang.String |
decodeHtmlBasicEntities(java.lang.String src)
Does the opposite job of encodeHtmlBasicEntities. |
|
static int[] |
decodeIntArray(java.lang.String param)
|
|
static int[] |
decodeIntArray(java.lang.String param,
char separator)
|
|
static java.lang.Object |
decodeObject(java.lang.String encoded)
Returns the object decoded from the given String. |
|
static java.lang.String[] |
decodeStringArray(java.lang.String param)
|
|
static java.lang.String[] |
decodeStringArray(java.lang.String param,
char separator)
|
|
static java.lang.String |
decodeUrl(java.lang.String str)
|
|
static java.lang.String |
decryptDES3(java.lang.String encryptedStr)
Decrypt the specified string using DESede StringEncrypter using same internal key
used by encryptDES3(String). |
|
static
|
emptyTreeSet()
Returns the empty TreeSet (immutable). |
|
static java.lang.String |
encodeBASE64(java.lang.String str)
Encode the given string using BASE64 algorithm. |
|
static java.lang.String |
encodeBASE64(java.lang.String str,
boolean isChunck)
Encode the given string using BASE64 algorithm. |
|
static java.lang.String |
encodeCookie(java.lang.String src)
|
|
static java.lang.String |
encodeHtmlBasicEntities(java.lang.String src)
Encode given string according to the following table. |
|
static java.lang.String |
encodeIntArray(int[] array)
|
|
static java.lang.String |
encodeIntArray(int[] array,
char separator)
|
|
static java.lang.String |
encodeJavaScriptQuote(java.lang.String str)
Encode JavaScript quotes for JavaScript that using Labels with beautification ' -> ’ " -> ’’ |
|
static java.lang.String |
encodeObject(java.lang.Object obj)
Returns the encoded objected as a String. |
|
static java.lang.String |
encodeStringArray(java.lang.String[] array)
|
|
static java.lang.String |
encodeStringArray(java.lang.String[] array,
char separator)
|
|
static java.lang.String |
encodeUrl(java.lang.String s)
Same implementation as URLEncoder.encode(String, String),
but space is encoded with %20 and '/' is not encoded. |
|
static java.lang.String |
encodeUrl(java.lang.String s,
java.lang.String enc)
Same implementation as URLEncoder.encode(String, String),
but space is encoded with %20 and '/' is not encoded. |
|
static java.lang.String |
encryptDES3(java.lang.String clearStr)
Encrypt the specified string using DESede StringEncrypter with an internal key. |
|
static java.lang.String |
entitiesToIsoLatin1(java.lang.String src)
Does the opposite of isoLatin1ToEntities. |
|
static java.lang.String |
escapeBackslash(java.lang.String str)
Escape all the '\' in the given String ('\\') |
|
static java.lang.String |
escapeChars(java.lang.String str,
java.lang.String charsToEscape)
Escape specified characters in a String. |
|
static java.lang.String |
escapeHtml(java.lang.String str)
Escapes some special HTML characters such as <, >, & and ". |
|
static java.lang.String |
escapeHtmlQuote(java.lang.String str)
Escape simple and double quote as HTML entity. |
|
static java.lang.String |
escapeInputQuote(java.lang.String str)
Escapes the quote (") character from the specified string. |
|
static java.lang.String |
escapeJavaScriptQuote(java.lang.String str)
Escape JavaScript quotes ' -> \' " -> \" |
|
static java.lang.String |
escapeJavaStringChar(java.lang.String str)
Escape all the invalide char in Java String: '\' -> "\\" CR -> "\n" '"' -> \" |
|
static java.lang.String |
escapeLuceneQuery(java.lang.String str)
Escape Lucene special chars. |
|
static java.lang.String |
escapePercent(java.lang.String url)
This method replace % in wrong hexa character by '_' character |
|
static java.lang.String |
escapeRegexp(java.lang.String string)
Escape a (OROMatcher) regular expression with support of basic regexp (* and ?). |
|
static java.lang.String |
escapeRegexp(java.lang.String string,
boolean basicRegexp)
Escape a (OROMatcher) regular expression with support of basic regexp (* and ?). |
|
static int |
exec(java.lang.String... cmdarray)
Executes the specified command and arguments in a separate process. |
|
static int |
exec(java.lang.String[] cmdarray,
java.io.OutputStream stdout,
java.io.OutputStream stderr)
Executes the specified command and arguments in a separate process. |
|
static int |
exec(java.lang.String[] cmdarray,
java.lang.StringBuilder stdout,
java.lang.StringBuilder stderr)
Executes the specified command and arguments in a separate process. |
|
static boolean |
forceFullGarbageCollection(long timeout)
Force the garbage collection |
|
static java.lang.String |
formatDuration(java.util.Date begin,
java.util.Date end)
Deprecated. Use DateUtil.formatDuration(Date,Date) instead |
|
static java.lang.String |
formatDuration(java.util.Date begin,
java.util.Date end,
java.util.Locale locale)
Deprecated. Use DateUtil.formatDuration(Date,Date,Locale) instead |
|
static java.lang.String |
formatDuration(long time)
Deprecated. Use DateUtil.formatDuration(long) instead |
|
static java.lang.String |
formatDuration(long time,
java.util.Locale locale)
Deprecated. Use DateUtil.formatDuration(long,Locale) instead |
|
static java.lang.String |
formatFileSize(long size)
This method format the given size on the greatest unit. |
|
static java.lang.String |
formatFileSize(long size,
java.util.Locale locale)
This method format the given size on the greatest unit. |
|
static java.lang.String |
formatFileSize(long size,
java.util.Locale locale,
boolean htmlDisplay)
This method format the given size on the greatest unit. |
|
static java.lang.String |
formatIso8601Date(java.util.Date date)
Deprecated. Use DateUtil.formatIso8601Date(Date) instead |
|
static java.lang.String |
formatNoSpaceDate(java.util.Date date)
Deprecated. Use DateUtil.formatNoSpaceDate(Date) instead |
|
static java.lang.String |
formatRfc822Date(java.util.Date date)
Deprecated. Use DateUtil.formatRfc822Date(Date) instead |
|
static java.lang.String |
formatSize(long size,
java.util.Locale locale)
This method format the given size on the greatest unit. |
|
static java.lang.String |
formatW3cDate(java.util.Date date)
Deprecated. Use DateUtil.formatW3cDate(Date) instead |
|
static java.lang.String |
generatePassword()
|
|
static java.lang.String |
generatePassword(int length)
|
|
static java.lang.String |
generatePronounceablePassword(int pwdLength)
Generates pronounceable passwords of specified length. |
|
static java.util.Set |
getAllChildren(TreeNode node,
java.util.Set nodeSet)
Fill the given set with every children of the given treenode, including the node itself, returns the filled set. |
|
static java.util.TreeSet |
getAllChildrenSet(TreeNode node)
Returns a TreeSet with all children of the given treenode, (including the node itself) |
|
static
|
getArrayList(T... array)
Returns a new ArrayList filled with the given objects (skip null object). |
|
static boolean |
getBoolean(boolean[] array,
int index,
boolean defaultValue)
|
|
static java.lang.Object |
getChildListMap(java.util.Map map,
java.lang.String key)
Returns the first Value matching the given key |
|
static java.util.List |
getChildrenListMap(java.util.Map map,
java.lang.String key)
Returns values matching the given key. |
|
static java.util.List |
getChildrenListMap(java.util.Map map,
java.lang.String[] keys)
Returns a new List of values matching the ordered given keys. |
|
static java.util.Set<java.lang.String> |
getClassFiles(java.lang.String realPath,
java.lang.String fullname,
boolean java)
Returns a Set of relative path to all class files including inner class and java. |
|
static java.lang.String |
getClassNameFromFilename(java.lang.String filename)
Returns the class name from the filename of a class (e.g. it returns "com.jalios.util.Util" for "com/jalios/util/Util.class") |
|
static java.lang.String |
getClassShortName(java.lang.Class clazz)
Returns the short name of the given class (e.g. |
|
static java.lang.String |
getClassShortName(java.lang.Object object)
Returns the short name of the given object's class (e.g. |
|
static java.lang.String |
getClassShortName(java.lang.String fullname)
Returns the short name of the given class name (e.g. |
|
static java.lang.String |
getCurrentStackTrace()
Returns the current StackTrace in a String. |
|
static
|
getFirst(java.util.Collection<T> coll)
Returns the first itemp of the given collection (or null if the collection is empty). |
|
static
|
getFirst(T[] array)
Returns the first itemp of the given array (or null if the array is empty). |
|
static java.lang.Class |
getFirstCommonClass(java.lang.Class parent,
java.lang.Class child)
Follow class tree of parent to find a class or an interface that is also parent of the child. |
|
static java.lang.String |
getFirstSentences(java.lang.String text,
int limit)
Get the first sentences in a given string. |
|
static
|
getHashMap(K key,
V value)
Returns a new HashMap filled with the given key/value pair (if the key is not null). |
|
static
|
getHashMap(java.util.Map<K,V> map)
Returns a new HashMap filled with the given map (if it is not null) |
|
static
|
getHashSet(T... array)
Returns a new HashSet filled with the given objects (skip null object). |
|
static java.lang.String |
getHtmlIcon(java.lang.String src,
java.lang.String alt)
Build an icon |
|
static int |
getInt(int[] array,
int index,
int defaultValue)
|
|
static
|
getKey(java.util.Map<K,V> map,
V value)
Iterate over a Map, looking for a Key associated to a given value. |
|
static
|
getKeys(java.util.Map<K,V> map,
V value)
Iterate over a Map, looking for a Keys associated to a given value. |
|
static
|
getLinkedHashMap(K key,
V value)
Returns a new LinkedHashMap filled with the given key/value pair (if the key is not null). |
|
static
|
getLinkedHashMap(java.util.Map<K,V> map)
Returns a new LinkedHashMap filled with the given map (if it is not null) |
|
static java.lang.String |
getMatch(java.util.regex.Pattern pattern,
java.lang.String str,
int group)
Return the group matching the given regexp for the given String or null if do not match or exception happens |
|
static java.lang.String |
getMatch(java.lang.String regexp,
java.lang.String str,
int group)
Return the group matching the given regexp for the given String or null if do not match or exception happens |
|
static java.util.Date |
getNewDateWithoutMillis()
Deprecated. Use DateUtil.getNewDateWithoutMillis() instead |
|
static java.lang.Object |
getObject(java.lang.Object[] array,
int index,
java.lang.Object defaultValue)
|
|
static int |
getSize(boolean[] array)
Returns the size of the given array. |
|
static int |
getSize(byte[] array)
Returns the size of the given array. |
|
static int |
getSize(char[] array)
Returns the size of the given array. |
|
static int |
getSize(java.util.Collection coll)
Returns the size of the given collection. |
|
static int |
getSize(double[] array)
Returns the size of the given array. |
|
static int |
getSize(float[] array)
Returns the size of the given array. |
|
static int |
getSize(int[] array)
Returns the size of the given array. |
|
static int |
getSize(long[] array)
Returns the size of the given array. |
|
static int |
getSize(java.util.Map map)
Returns the size of the given map. |
|
static int |
getSize(java.lang.Object[] array)
Returns the size of the given array. |
|
static int |
getSize(short[] array)
Returns the size of the given array. |
|
static int |
getSize(java.lang.String str)
Returns the size of the given String. |
|
static java.lang.String |
getStackTrace(java.lang.Throwable throwable)
This method print the stack trace into a String and return it. |
|
static java.lang.String |
getString(java.lang.Object[] array,
int index,
java.lang.String defaultValue)
Call the method getString() with the Object in the array specified at the given index. |
|
static java.lang.String |
getString(java.lang.Object obj,
java.lang.String defaultValue)
Return the String representation of the given object if it is not null nor empty, otherwise it returns the default value. |
|
static java.util.List |
getSuperclassList(java.lang.Class clazz,
java.lang.Class ancestor,
boolean addClass,
boolean addAncestor)
Returns a list of classes the given class is an ancestor of. |
|
static java.util.TreeSet |
getTreeDescendantSet(TreeNode node)
Returns a TreeSet with all descendant of the given treenode, (excluding the node itself) |
|
static java.util.Set |
getTreeDescendantSet(TreeNode node,
java.util.Set nodeSet)
|
|
static
|
getTreeMap(K key,
V value)
Returns a new TreeMap filled with the given key/value pair (if the key is not null). |
|
static
|
getTreeMap(java.util.Map<K,V> map)
Returns a new TreeMap filled with the given map (if it is not null) |
|
static
|
getTreeSet(T... array)
Returns a new TreeSet filled with the given objects (skip null object). |
|
static boolean |
hasAppenderDefined(org.apache.log4j.Logger logger)
Checks if the given Logger has any appender defined. |
|
static java.lang.String |
html2Ascii(java.lang.String text)
Convert a given text from HTML to ASCII. |
|
static int |
indexOf(java.lang.Object elem,
java.lang.Object[] array)
Searches for the first occurence of the given argument in a given array, testing for equality using the equals method. |
|
static boolean[] |
insertArray(boolean[] array,
int index,
boolean elt)
Insert an element into a boolean array and return a duplicate copy of it. |
|
static int[] |
insertArray(int[] array,
int index,
int elt)
Insert an element into an int array and return a duplicate copy of it. |
|
static java.lang.Object[] |
insertArray(java.lang.Object[] array,
int index,
java.lang.Object elt)
Insert an element into an Object array and return a duplicate copy of it. |
|
static
|
interMap(java.util.Map<? extends K,? extends V> map,
java.util.Set<? extends K> keys)
This method will return a new Map containing only values of specified map with given keys. |
|
static java.util.Set |
interSet(java.util.Set... sets)
Returns the intersection of an array of Set. |
|
static java.util.Set |
interSet(java.util.Set set1,
java.util.Set set2)
Returns the intersection of two Set. |
|
static java.util.Set |
interSet(java.util.Set set1,
java.util.Set set2,
java.util.Set set3)
Returns the intersection of three Set. |
|
static boolean |
isChildNode(TreeNode node,
TreeNode child)
Test if a node is a child of an other node Return false if child == node |
|
static boolean |
isEmpty(boolean[] array)
Returns true if this array is null or empty. |
|
static boolean |
isEmpty(byte[] array)
Returns true if this array is null or empty. |
|
static boolean |
isEmpty(char[] array)
Returns true if this array is null or empty. |
|
static boolean |
isEmpty(java.util.Collection<?> c)
Returns true if this collection is
null or empty. |
|
static boolean |
isEmpty(java.util.Collection<?> c,
boolean deep)
Returns true if this collection is
null or empty. |
|
static boolean |
isEmpty(double[] array)
Returns true if this array is null or empty. |
|
static boolean |
isEmpty(java.io.File file)
Returns true if this file is
null or empty. |
|
static boolean |
isEmpty(java.io.File file,
java.io.FileFilter fileFilter)
Returns true if this file is
null or empty. |
|
static boolean |
isEmpty(float[] array)
Returns true if this array is null or empty. |
|
static boolean |
isEmpty(int[] array)
Returns true if this array is null or empty. |
|
static boolean |
isEmpty(long[] array)
Returns true if this array is null or empty. |
|
static boolean |
isEmpty(java.util.Map<?,?> map)
Returns true if this map is
null or empty. |
|
static boolean |
isEmpty(java.lang.Object object)
Returns true if this object is
null or empty. |
|
static boolean |
isEmpty(java.lang.Object[] array)
Returns true if this array is
null or empty. |
|
static boolean |
isEmpty(java.lang.Object[] array,
boolean recursive)
Returns true if this array is
null or empty. |
|
static boolean |
isEmpty(short[] array)
Returns true if this array is null or empty. |
|
static boolean |
isEmpty(SQLQueryResult sqr)
Returns true if this SQLQueryResult is
null or empty. |
|
static boolean |
isEmpty(java.lang.String s)
Returns true if this string is null or
empty (once trimmed). |
|
static
|
isMapFilled(java.util.Map<K,V> map)
Returns true if the given map contains at least one value not empty. |
|
static boolean |
isNumber(java.lang.String str)
Returns true if the given string only contains 0-9 characters |
|
static java.lang.String |
isoLatin1ToEntities(java.lang.String src)
Convert all the isoLatin1 accent into XML entities (e.g. |
|
static boolean |
isSameContent(boolean[] array1,
boolean[] array2)
Returns true if array1 has same content than array2. |
|
static boolean |
isSameContent(byte[] array1,
byte[] array2)
Returns true if array1 has same content than array2. |
|
static boolean |
isSameContent(char[] array1,
char[] array2)
Returns true if array1 has same content than array2. |
|
static boolean |
isSameContent(java.util.Date date1,
java.util.Date date2)
Returns true if date1 has same content than date2. |
|
static boolean |
isSameContent(double[] array1,
double[] array2)
Returns true if array1 has same content than array2. |
|
static boolean |
isSameContent(org.jdom.Element elt1,
org.jdom.Element elt2)
Returns true if elt1 has same content than elt2. |
|
static boolean |
isSameContent(float[] array1,
float[] array2)
Returns true if array1 has same content than array2. |
|
static boolean |
isSameContent(int[] array1,
int[] array2)
Returns true if array1 has same content than array2. |
|
static boolean |
isSameContent(java.util.List list1,
java.util.List list2)
Returns true if list1 has same content than list2. |
|
static boolean |
isSameContent(long[] array1,
long[] array2)
Returns true if array1 has same content than array2. |
|
static boolean |
isSameContent(java.util.Map map1,
java.util.Map map2)
Returns true if map1 has same content than map2. |
|
static boolean |
isSameContent(java.lang.Object[] array1,
java.lang.Object[] array2)
Returns true if array1 has same content than array2. |
|
static boolean |
isSameContent(java.util.Set set1,
java.util.Set set2)
Returns true if set1 has same content than set2. |
|
static boolean |
isSameContent(short[] array1,
short[] array2)
Returns true if array1 has same content than array2. |
|
static boolean |
isSameContent(java.lang.String str1,
java.lang.String str2)
Returns true if str1 has same content than str2. |
|
static boolean |
isSameDay(java.util.Date date1,
java.util.Date date2)
Deprecated. Use DateUtil.isSameDay(Date,Date) instead |
|
static boolean |
isToday(java.util.Date date)
Deprecated. Use DateUtil.isToday(Date) instead |
|
static boolean |
isTomorrow(java.util.Date date)
Deprecated. Use DateUtil.isTomorrow(Date) instead |
|
static boolean |
isYesterday(java.util.Date date)
Deprecated. Use DateUtil.isYesterday(Date) instead |
|
static java.lang.String |
join(boolean[] array,
java.lang.String sep)
Joins an array of boolean with the given separator. |
|
static java.lang.String |
join(boolean[] array,
java.lang.String sep,
int max,
java.lang.String suffix)
Joins an array of boolean with the given separator. |
|
static java.lang.String |
join(java.util.Collection<?> col,
java.lang.String sep)
Joins a collection of Object with the given separator into a String. |
|
static java.lang.String |
join(java.util.Collection<?> col,
java.lang.String sep,
int max,
java.lang.String suffix)
Joins a collection of Object with the given separator into a String. |
|
static java.lang.String |
join(double[] array,
java.lang.String sep)
Joins an array of double with the given separator. |
|
static java.lang.String |
join(double[] array,
java.lang.String sep,
int max,
java.lang.String suffix)
Joins an array of double with the given separator. |
|
static java.lang.String |
join(int[] array,
java.lang.String sep)
Joins an array of int with the given separator. |
|
static java.lang.String |
join(int[] array,
java.lang.String sep,
int max,
java.lang.String suffix)
Joins an array of int with the given separator. |
|
static java.lang.String |
join(java.util.Iterator<?> it,
java.lang.String sep)
Joins a collection of Object with the given separator into a String. |
|
static java.lang.String |
join(java.util.Iterator<?> it,
java.lang.String sep,
int max,
java.lang.String suffix)
Joins a collection of Object with the given separator into a String. |
|
static java.lang.String |
join(long[] array,
java.lang.String sep)
Joins an array of long with the given separator. |
|
static java.lang.String |
join(long[] array,
java.lang.String sep,
int max,
java.lang.String suffix)
Joins an array of long with the given separator. |
|
static java.lang.String |
join(java.lang.Object[] array,
java.lang.String sep)
Joins an array of String with the given separator. |
|
static java.lang.String |
join(java.lang.Object[] array,
java.lang.String sep,
int max,
java.lang.String suffix)
Joins an array of String with the given separator. |
|
static java.lang.String |
join(java.lang.String... str)
Join String with a given separator First String is the separator Always return a String If Str1 or Str2 is null then return the other value without separator |
|
static java.lang.String |
joinMap(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map,
java.lang.String keyValueSep,
java.lang.String entrySep)
Joins the entries of a map into a String. |
|
static void |
listDictionary(java.util.Dictionary<?,?> dict)
Lists a Dictionnary on System.out. |
|
static void |
listDictionary(java.util.Dictionary<?,?> dict,
java.io.PrintStream out)
Lists a Dictionnary on the given PrintStream. |
|
static void |
listDictionary(java.util.Dictionary<?,?> dict,
java.io.PrintStream out,
java.lang.String sep)
Lists a dictionnary on the given PrintStream with
the given separator. |
|
static void |
listMap(java.util.Map<?,?> map)
Lists a map on System.out. |
|
static void |
listMap(java.util.Map<?,?> map,
java.io.PrintStream out)
Lists a map on the given PrintStream. |
|
static void |
listMap(java.util.Map<?,?> map,
java.io.PrintStream out,
java.lang.String sep)
Lists a map on the given PrintStream with the given
separator. |
|
static void |
mainRemoveArray(java.lang.String[] args)
|
|
static void |
mainSwapArray(java.lang.String[] args)
|
|
static void |
mainTestBuildID(java.lang.String[] args)
|
|
static void |
mainTestEmpty(java.lang.String[] args)
|
|
static void |
mainTestEscapeLuceneQuery(java.lang.String[] args)
|
|
static void |
mainTestFormatDuration(java.lang.String[] args)
Deprecated. Use DateUtil.mainTestFormatDuration(String[]) instead |
|
static void |
mainTestGeneratePassword(java.lang.String[] args)
|
|
static void |
mainTestInterUnionSubSet(java.lang.String[] args)
|
|
static void |
mainTestJoin(java.lang.String[] args)
|
|
static boolean |
notEmpty(java.util.Collection<?> c)
Returns true if this collection is not
null nor empty. |
|
static boolean |
notEmpty(java.io.File file)
Returns true if this File is not
null nor empty. |
|
static boolean |
notEmpty(java.io.File file,
java.io.FileFilter fileFilter)
Returns true if this File is not
null nor empty. |
|
static boolean |
notEmpty(int[] array)
Returns true if this array is not null nor empty. |
|
static boolean |
notEmpty(java.util.Map<?,?> map)
Returns true if this map is not
null nor empty. |
|
static boolean |
notEmpty(java.lang.Object object)
Returns true if this object is not
null nor empty. |
|
static boolean |
notEmpty(java.lang.Object[] array)
Returns true if this array is not
null nor empty. |
|
static boolean |
notEmpty(java.lang.Object[] array,
boolean recursive)
Returns true if this array is not
null nor empty. |
|
static boolean |
notEmpty(SQLQueryResult map)
Returns true if this SQLQueryResult is not
null nor empty. |
|
static boolean |
notEmpty(java.lang.String s)
Returns true if this string is not null
nor empty (once trimmed). |
|
static java.util.Date |
parseIso8601Date(java.lang.String source)
Deprecated. Use DateUtil.parseIso8601Date(String) instead |
|
static java.util.Date |
parseNoSpaceDate(java.lang.String source)
Deprecated. Use DateUtil.parseNoSpaceDate(String) instead |
|
static java.util.Date |
parseRfc822Date(java.lang.String source)
Deprecated. Use DateUtil.parseRfc822Date(String) instead |
|
static java.util.Date |
parseW3cDate(java.lang.String source)
Deprecated. Use DateUtil.parseW3cDate(String) instead |
|
static java.lang.String |
performDecoding(java.lang.String src,
java.util.HashMap transMap)
Replace all occurences of values found in transMap with their assiocated keys. |
|
static java.lang.String |
performEncodeDecode(java.lang.String src,
java.util.HashMap transMap,
boolean decode)
Encode or decode the given String using the given translation Map. |
|
static java.lang.String |
performEncoding(java.lang.String src,
java.util.HashMap transMap)
Replace all occurences of keys found in transMap with their assiocated values. |
|
static java.util.Set<java.lang.String> |
prefixSet(java.util.Set<java.lang.String> set,
java.lang.String prefix)
Prefix all elements of a Set of String with a given prefix |
|
static
|
putAll(K[] array,
java.util.Map<K,V> map,
V value)
Copy all non-null objects from the given array to given map with a given value. |
|
static java.lang.String |
randomString(int length)
|
|
static java.lang.String |
recapitalize(java.lang.String str)
Force the first char of a String to be a uppercase char. |
|
static java.lang.String |
reduceBlankLines(java.lang.String text)
Right trim all the lines in the message and reduced many CRLF to only one line. |
|
static boolean[] |
removeArray(boolean[] array,
int index)
Remove an element of an Array of boolean |
|
static boolean[] |
removeArray(boolean[] array,
int from,
int to)
Remove n elements of an Array of boolean |
|
static int[] |
removeArray(int[] array,
int index)
Remove an element of an Array of int |
|
static int[] |
removeArray(int[] array,
int from,
int to)
Remove n elements of an Array of int |
|
static java.lang.Object[] |
removeArray(java.lang.Object[] array,
int index)
Remove an element of an Array of object |
|
static java.lang.Object[] |
removeArray(java.lang.Object[] array,
int from,
int to)
Remove n elements of an Array of object |
|
static java.lang.Object[] |
removeArray(java.lang.Object[] array,
java.lang.Object obj)
Remove an element of an Array of object |
|
static java.lang.String |
removeBlankLines(java.lang.String str)
Cleans the given string : remove pure blank lines and remove leadings white spaces. |
|
static
|
removeFromMapHashSet(java.util.Map<K,java.util.Set<V>> map,
K key,
V value)
A convenient method that remove the given value to a set bound to the given key in the given map. |
|
static
|
removeFromMapLinkedHashSet(java.util.Map<K,java.util.LinkedHashSet<V>> map,
K key,
V value)
A convenient method that remove the given value to a set bound to the given key in the given map. |
|
static java.lang.String |
removeJavaScriptQuote(java.lang.String str)
Remove JavaScript quotes |
|
static java.lang.String |
repeat(java.lang.String pattern,
int count)
Repeat a String pattern count times |
|
static java.lang.String |
replace(java.lang.String text,
org.apache.oro.text.regex.Pattern pattern,
RegexpSubstitution substitution)
Replaces the given pattern in the given text with the given substitution function. |
|
static java.lang.String |
replace(java.lang.String str,
java.lang.String pattern)
Search and replace a string by another one |
|
static java.lang.String |
replace(java.lang.String text,
java.lang.String regexp,
RegexpSubstitution substitution)
Replaces the given regexp in the given text with the given substitution function. |
|
static java.lang.String |
replace(java.lang.String str,
java.lang.String match,
java.lang.String rep)
Search and replace a string by another one (Note the input string must not contains '#' char) |
|
static java.lang.String |
replaceAll(java.lang.String input,
java.lang.String searchString,
java.lang.String replaceString)
Replace all occurence of searchString with replaceString in input string. |
|
static java.lang.String |
reveal(java.lang.String concealedStr)
Reveal the specified hidden string with an internally choosen encryption algorithm. |
|
static
|
reverseMap(java.util.Map<K,V> originalMap,
java.util.Map<V,K> reverseMap)
Fill the reverse map with the original map replacing keys by values and values by keys. |
|
static long |
roundDuration(long duration)
Deprecated. Use DateUtil.roundDuration(long) instead |
|
static java.lang.String[] |
split(java.lang.String str,
char delim,
java.lang.String emptyToken)
Splits a String into an array of String. |
|
static java.lang.String[] |
split(java.lang.String str,
java.lang.String delim)
Splits a String into an array of String. |
|
static int[] |
splitToIntArray(java.lang.String str,
java.lang.String delim)
Splits a String into an array of int. |
|
static java.util.ArrayList<java.lang.String> |
splitToList(java.lang.String str,
java.lang.String delim)
Splits a String into a list of String. |
|
static java.lang.String[] |
splitWithPattern(java.lang.String text,
java.lang.String pattern)
Splits a String according a given pattern and returns an array of String. |
|
static java.lang.String |
startsWith(java.lang.String str,
java.util.Collection<java.lang.String> coll)
Returns the String in the given collection that is a starting string og given str |
|
static java.util.Set<java.lang.String> |
stringArrayToCleanSet(java.lang.String[] array)
Returns a set which contains all the non empty cells of the given array. |
|
static
|
subMap(java.util.Map<K,V> map,
java.util.Set<K> keys)
This method will return a new Map containing all values of specified map without given keys. |
|
static java.util.Set |
subSet(java.util.Set... sets)
Returns the subset of an array of Set. |
|
static java.util.Set |
subSet(java.util.Set set1,
java.util.Set set2)
Returns the subset of an array of Set. |
|
static java.util.Set |
subSet(java.util.Set set1,
java.util.Set set2,
java.util.Set set3)
Returns the subset of an array of Set. |
|
static java.lang.String |
surround(java.lang.String inside,
java.lang.String begin,
java.lang.String end)
Surround a given text (the first argument) with the two other arguments, only if the given text is not empty. |
|
static java.lang.String |
surroundWithTag(java.lang.String inside,
java.lang.String tag)
Surround a given text (the first argument) with a html tag. |
|
static boolean[] |
swapArray(boolean[] array,
int from,
int to,
boolean roll,
boolean copy)
Swap two cells of a boolean array. |
|
static int[] |
swapArray(int[] array,
int from,
int to,
boolean roll,
boolean copy)
Swap two cells of an int array. |
|
static java.lang.Object[] |
swapArray(java.lang.Object[] array,
int from,
int to,
boolean roll,
boolean copy)
Swap two cells of an Object array. |
|
static boolean |
toBoolean(java.lang.Object obj,
boolean def)
Convert an Object (assert to be either a String or a Boolean) to a boolean |
|
static byte |
toByte(java.lang.Object obj,
byte def)
Convert an Object (assert to be either a String or a Byte) to a byte |
|
static char |
toChar(java.lang.Object obj,
char def)
Convert an Object (assert to be either a String or a Character) to a char |
|
static java.util.Date |
toDate(java.lang.String str,
java.lang.String format,
java.util.Locale loc,
java.util.Date def)
Parse a String and Convert it into a Date |
|
static double |
toDouble(java.lang.Object obj,
double def)
Convert an Object (assert to be either a String or a Double) to a double |
|
static float |
toFloat(java.lang.Object obj,
float def)
Convert an Object (assert to be either a String or a Float) to a float |
|
static int |
toInt(java.lang.Object obj,
int def)
Convert an Object (assert to be either a String or a Integer) to a int |
|
static int[] |
toIntArray(java.lang.Object[] objs,
int def)
Convert an Object[] (assert to be either a String or a Integer) to a int |
|
static java.util.Locale |
toLocale(java.lang.String str,
java.util.Locale def)
|
|
static long |
toLong(java.lang.Object obj,
long def)
Convert an Object (assert to be either a String or a Long) to a long |
|
static short |
toShort(java.lang.Object obj,
short def)
Convert an Object (assert to be either a String or a Short) to a short |
|
static java.lang.String |
toWordLine(java.lang.String str)
Split a text in a String with one word by line (used for diffing 2 strings at word level). |
|
static java.lang.String[] |
trim(java.lang.String[] array)
Remove the trailing empty cells of the given String array. |
|
static java.lang.String |
trimEnd(java.lang.String str)
Trim the end of a String |
|
static
|
trimList(java.util.List<T> list)
Returns a copy of the given list without any null values at the end. |
|
static java.lang.String[] |
trimStringArray(java.lang.String[] array)
Remove the trailing empty cells of the given String array. |
|
static java.lang.String |
truncate(java.lang.String str,
int length)
Truncates the given String. |
|
static java.lang.String |
truncate(java.lang.String str,
int length,
java.lang.String suffix)
Truncates the given String |
|
static java.lang.String |
truncateHtml(java.lang.String text,
int length,
boolean trim)
Truncate an HTML string. |
|
static java.lang.String |
unaccentuate(java.lang.String str)
Removes all the accentuate chars of the given string. |
|
static java.lang.String |
unaccentuateRegexp(java.lang.String str)
Build an unaccentuated version of the given regexp. |
|
static java.lang.String |
uncapitalize(java.lang.String str)
Force the first char of a String to be a lowercase char. |
|
static java.lang.String |
unescapeChar(java.lang.String str)
Unescape escaped character in a String. |
|
static java.util.Set<?> |
unionSet(java.util.Set<?>... sets)
Returns the union of an array of Set. |
|
static java.util.Set |
unionSet(java.util.Set set1,
java.util.Set set2)
Returns the union of two Set. |
|
static java.util.Set |
unionSet(java.util.Set set1,
java.util.Set set2,
java.util.Set set3)
Returns the union of three Set. |
|
static void |
updateListMap(java.util.Map map,
java.lang.Object key,
java.lang.Object value,
boolean lazy)
Updated Map with the given key/value pair. |
|
static boolean |
validateRegexp(java.lang.String regexp)
Tell if a String is a valid Perl 5 regexp. |
|
static java.lang.String |
wordWrap(java.lang.String str,
int width)
Wraps a single line of text, identifying words by ' '. |
|
static java.lang.String |
wordWrap(java.lang.String str,
int wrapLength,
java.lang.String newLineStr,
boolean wrapLongWords)
Wraps a single line of text, identifying words by ' '. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String REVISION
public static final java.util.TreeSet EMPTY_TREESET
emptyTreeSet() for generics compliance.
public static final java.util.HashMap<java.lang.String,java.lang.String> regexpEscaped1
public static final java.util.HashMap<java.lang.String,java.lang.String> regexpEscaped2
public static final java.util.HashMap<java.lang.String,java.lang.String> regexpEscaped3
protected static org.apache.oro.text.regex.Pattern hexaPercentPattern
protected static org.apache.oro.text.regex.Perl5Substitution hexaPercentSubst
protected static org.apache.oro.text.regex.Perl5Compiler hexaPercentCompiler
public static final char ESCAPE_CHAR
public static final java.util.HashMap<java.lang.String,java.lang.String> cookieTransTable
public static final java.util.HashMap<java.lang.String,java.lang.String> isoLatin1_xml
public static final java.util.HashMap basicEntitiesEncodingMap
public static final java.util.HashMap basicEntitiesDecodingMap
| Method Detail |
|---|
public static final <T> java.util.TreeSet<T> emptyTreeSet()
This example illustrates the type-safe way to obtain an empty set:
TreeSet<String> s = Util.emptyTreeSet();
EMPTY_TREESET
public static <K,V> java.lang.Object getKey(java.util.Map<K,V> map,
V value)
map - the Map to searhc onvalue - the value to search
public static <K,V> java.util.Set<K> getKeys(java.util.Map<K,V> map,
V value)
map - the Map to searhc onvalue - the value to search
public static void updateListMap(java.util.Map map,
java.lang.Object key,
java.lang.Object value,
boolean lazy)
map - Map to work withkey - Object key of the Mapvalue - Object value of the maplazy - boolean true to create List only after 2 elements
public static java.lang.Object getChildListMap(java.util.Map map,
java.lang.String key)
map - the Mapkey - Object key of the Map
public static java.util.List getChildrenListMap(java.util.Map map,
java.lang.String key)
map - the Mapkey - Object key of the Map
public static java.util.List getChildrenListMap(java.util.Map map,
java.lang.String[] keys)
map - the Mapkeys - Object key of the Map
public static <K,V> java.util.Map<V,K> reverseMap(java.util.Map<K,V> originalMap,
java.util.Map<V,K> reverseMap)
K - V - originalMap - reverseMap -
public static <K,V> java.util.Map.Entry<K,V> compareMap(java.util.Map<K,V> map1,
java.util.Map<K,V> map2)
map1 - the first mapmap2 - the second map.
public static <K,V> boolean isMapFilled(java.util.Map<K,V> map)
map - the map.
public static <T> java.util.Collection<T> addAll(java.util.Collection<T> collection,
java.util.Enumeration<T> enu)
collection - enu -
public static <T> java.util.Collection<T> addAll(java.util.Collection<T> collection,
java.util.Iterator<T> it)
collection - the collectionit - the iterator
public static java.lang.String startsWith(java.lang.String str,
java.util.Collection<java.lang.String> coll)
str - the String to matchcoll - a Collection of String that may be start of str
public static java.lang.String getString(java.lang.Object obj,
java.lang.String defaultValue)
obj - the objectdefaultValue - the default value
public static java.lang.String getString(java.lang.Object[] array,
int index,
java.lang.String defaultValue)
array - the object arrayindex - the indexdefaultValue - the default value
public static java.lang.Object getObject(java.lang.Object[] array,
int index,
java.lang.Object defaultValue)
public static int getInt(int[] array,
int index,
int defaultValue)
public static boolean getBoolean(boolean[] array,
int index,
boolean defaultValue)
public static int getSize(java.lang.String str)
str - the String.
public static int getSize(java.lang.Object[] array)
array - the array.
public static int getSize(byte[] array)
array - an array of byte.
public static int getSize(short[] array)
array - an array of short.
public static int getSize(int[] array)
array - an array of int.
public static int getSize(long[] array)
array - an array of long.
public static int getSize(float[] array)
array - an array of float.
public static int getSize(double[] array)
array - an array of double.
public static int getSize(boolean[] array)
array - an array of boolean.
public static int getSize(char[] array)
array - an array of char.
public static int getSize(java.util.Collection coll)
coll - the collection.
public static int getSize(java.util.Map map)
map - the map.
public static boolean notEmpty(java.io.File file)
true if this File is not
null nor empty.
file - the file to test
public static boolean isEmpty(java.io.File file)
true if this file is
null or empty.
file - the file to test
public static boolean notEmpty(java.io.File file,
java.io.FileFilter fileFilter)
true if this File is not
null nor empty.
file - the file to testfileFilter - the filter
public static boolean isEmpty(java.io.File file,
java.io.FileFilter fileFilter)
true if this file is
null or empty.
file - the file to testfileFilter - the filter
public static boolean notEmpty(java.lang.Object object)
true if this object is not
null nor empty.
object - the object to test
public static boolean isEmpty(java.lang.Object object)
true if this object is
null or empty.
object - the object to test
public static boolean notEmpty(int[] array)
true if this array is not null nor empty.
array - the array to test
public static boolean isEmpty(int[] array)
true if this array is null or empty.
array - the array to test
public static boolean isEmpty(long[] array)
true if this array is null or empty.
array - the array to test
public static boolean isEmpty(byte[] array)
true if this array is null or empty.
array - the array to test
public static boolean isEmpty(short[] array)
true if this array is null or empty.
array - the array to test
public static boolean isEmpty(float[] array)
true if this array is null or empty.
array - the array to test
public static boolean isEmpty(double[] array)
true if this array is null or empty.
array - the array to test
public static boolean isEmpty(boolean[] array)
true if this array is null or empty.
array - the array to test
public static boolean isEmpty(char[] array)
true if this array is null or empty.
array - the array to test
public static boolean notEmpty(java.lang.Object[] array)
true if this array is not
null nor empty.
array - the array to test
public static boolean isEmpty(java.lang.Object[] array)
true if this array is
null or empty.
array - the array to test
public static boolean notEmpty(java.lang.Object[] array,
boolean recursive)
true if this array is not
null nor empty.
array - the array to testrecursive - check if arrays elements are empty
public static boolean isEmpty(java.lang.Object[] array,
boolean recursive)
true if this array is
null or empty.
array - the array to testrecursive - check if arrays elements are empty
public static boolean notEmpty(java.util.Collection<?> c)
true if this collection is not
null nor empty.
c - the collection to test
public static boolean isEmpty(java.util.Collection<?> c)
true if this collection is
null or empty.
c - the collection to test
public static boolean isEmpty(java.util.Collection<?> c,
boolean deep)
true if this collection is
null or empty.
c - the collection to testdeep - to call Util.isEmpty on content otherwise check only == null
public static boolean notEmpty(java.util.Map<?,?> map)
true if this map is not
null nor empty.
map - the map to test
public static boolean isEmpty(SQLQueryResult sqr)
true if this SQLQueryResult is
null or empty.
sqr - the SQLQueryResult to test
public static boolean notEmpty(SQLQueryResult map)
true if this SQLQueryResult is not
null nor empty.
map - the SQLQueryResult to test
public static boolean isEmpty(java.util.Map<?,?> map)
true if this map is
null or empty.
map - the map to test
public static void mainTestEmpty(java.lang.String[] args)
public static java.lang.String join(java.util.Collection<?> col,
java.lang.String sep)
toString() method for each iterated
Object.
col - the collectionsep - the separator
public static java.lang.String join(java.util.Collection<?> col,
java.lang.String sep,
int max,
java.lang.String suffix)
toString() method for each iterated
Object.
col - the collectionsep - the separatormax - the maximum of item to joinsuffix - the suffix to add if the maximum has been reached
public static java.lang.String join(java.util.Iterator<?> it,
java.lang.String sep)
toString() method for each iterated
Object.
it - the iterator of the collectionsep - the separator
public static java.lang.String join(java.util.Iterator<?> it,
java.lang.String sep,
int max,
java.lang.String suffix)
toString() method for each iterated
Object.
it - the iterator of the collectionsep - the separatormax - the maximum of item to joinsuffix - the suffix to add if the maximum has been reached
public static java.lang.String joinMap(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map,
java.lang.String keyValueSep,
java.lang.String entrySep)
Mapmap = new LinkedHashMap (); map.put("simpleobject", "bar"); map.put("stringarray", new String[] { "hi", "hello" } ); List
map - the map to join akeyValueSep - the separator to use between key and the valueentrySep - the separator to use between each entry
public static void listMap(java.util.Map<?,?> map)
System.out.
map - the map to list
public static void listMap(java.util.Map<?,?> map,
java.io.PrintStream out)
PrintStream.
map - the map to listout - the PrintStream to use to list the map
public static void listMap(java.util.Map<?,?> map,
java.io.PrintStream out,
java.lang.String sep)
PrintStream with the given
separator.
map - the map to listout - the PrintStream to use to list the mapsep - the separatorpublic static void listDictionary(java.util.Dictionary<?,?> dict)
System.out.
dict - the Dictionnary to list
public static void listDictionary(java.util.Dictionary<?,?> dict,
java.io.PrintStream out)
PrintStream.
dict - the Dictionnary to listout - the PrintStream to use to list the dictionnary
public static void listDictionary(java.util.Dictionary<?,?> dict,
java.io.PrintStream out,
java.lang.String sep)
PrintStream with
the given separator.
dict - the dictionnary to listout - the PrintStream to use to list the dictionnarsep - the separator
public static <K,V> java.util.Map<K,V> subMap(java.util.Map<K,V> map,
java.util.Set<K> keys)
map - Map to work onkeys - Set of key to remove
public static <K,V> java.util.Map<? extends K,? extends V> interMap(java.util.Map<? extends K,? extends V> map,
java.util.Set<? extends K> keys)
map - Map to work onkeys - Set of key
public static java.util.Set<java.lang.String> prefixSet(java.util.Set<java.lang.String> set,
java.lang.String prefix)
set - Set of Stringprefix - a String to prefix
public static java.util.Set<?> unionSet(java.util.Set<?>... sets)
Set. The result set does not contains null item.
sets - an array of Set
Set (same class as the first set)
public static java.util.Set unionSet(java.util.Set set1,
java.util.Set set2)
Set.
set1 - the first Setset2 - the second Set
Set
public static java.util.Set unionSet(java.util.Set set1,
java.util.Set set2,
java.util.Set set3)
Set.
set1 - the first Setset2 - the second Setset3 - the thrid Set
Setpublic static java.util.Set interSet(java.util.Set... sets)
Set.
sets - an array of Set
Set (same class as the first set, with same comparator for TreeSet)
containing only element presents in all the given set.
does not return a new set if only one set was given, instead return the given set.
public static java.util.Set interSet(java.util.Set set1,
java.util.Set set2)
Set.
set1 - the first Setset2 - the second Set
Set
public static java.util.Set interSet(java.util.Set set1,
java.util.Set set2,
java.util.Set set3)
Set.
set1 - the first Setset2 - the second Setset3 - the thrid Set
Setpublic static java.util.Set subSet(java.util.Set... sets)
Set. The subset
contains all the elements of the first Set without
those of the other Set.
sets - an array of Set
Set (same class as the first set)
public static java.util.Set subSet(java.util.Set set1,
java.util.Set set2)
Set. The subset
contains all the elements of the first Set without
those of the second Set.
set1 - the first Setset2 - the second Set
Set
public static java.util.Set subSet(java.util.Set set1,
java.util.Set set2,
java.util.Set set3)
Set. The subset
contains all the elements of the first Set without
those of the second and third Set.
set1 - the first Setset2 - the second Setset3 - the third Set
Setpublic static <T> java.util.ArrayList<T> getArrayList(T... array)
T - any typearray - a varargs of objects
public static <T> java.util.HashSet<T> getHashSet(T... array)
T - any typearray - a varargs of objects
public static <T> java.util.TreeSet<T> getTreeSet(T... array)
T - any typearray - a varargs of objects
public static <K,V> java.util.HashMap<K,V> getHashMap(K key,
V value)
K - any typeV - any typekey - the first key to be addedvalue - the first value to be added
public static <K,V> java.util.HashMap<K,V> getHashMap(java.util.Map<K,V> map)
K - any typeV - any typemap - the map to be added
public static <K,V> java.util.TreeMap<K,V> getTreeMap(K key,
V value)
K - any typeV - any typekey - the first key to be addedvalue - the first value to be added
public static <K,V> java.util.TreeMap<K,V> getTreeMap(java.util.Map<K,V> map)
K - any typeV - any typemap - the map to be added
public static <K,V> java.util.LinkedHashMap<K,V> getLinkedHashMap(K key,
V value)
K - any typeV - any typekey - the first key to be addedvalue - the first value to be added
public static <K,V> java.util.LinkedHashMap<K,V> getLinkedHashMap(java.util.Map<K,V> map)
K - any typeV - any typemap - the map to be added
public static <T> T getFirst(java.util.Collection<T> coll)
coll - the collection
public static <T> T getFirst(T[] array)
array - the array
public static <K,V> void addInMapHashSet(java.util.Map<K,java.util.Set<V>> map,
K key,
V value)
map - the mapkey - the keyvalue - the value
public static <K,V> void removeFromMapHashSet(java.util.Map<K,java.util.Set<V>> map,
K key,
V value)
map - the mapkey - the keyvalue - the value
public static <K,V> void addInMapLinkedHashSet(java.util.Map<K,java.util.LinkedHashSet<V>> map,
K key,
V value)
map - the mapkey - the keyvalue - the value
public static <K,V> void removeFromMapLinkedHashSet(java.util.Map<K,java.util.LinkedHashSet<V>> map,
K key,
V value)
map - the mapkey - the keyvalue - the valuepublic static void mainTestInterUnionSubSet(java.lang.String[] args)
public static <T> java.util.Collection<T> cleanCollection(java.util.Collection<T> coll)
coll - the collection to be cleaned
public static <T> java.util.Set<T> collectionToCleanSet(java.util.Collection<T> coll)
coll - the collection
public static java.util.Set<java.lang.String> stringArrayToCleanSet(java.lang.String[] array)
array - the array
public static <T> java.util.Collection<T> addAll(T[] array,
java.util.Collection<T> coll)
array - the array to copy fromcoll - the collection to copy to
public static <K,V> java.util.Map<K,V> putAll(K[] array,
java.util.Map<K,V> map,
V value)
array - the array to copy frommap - the collection to copy tovalue - the value to set
public static int[] swapArray(int[] array,
int from,
int to,
boolean roll,
boolean copy)
array - the arrayfrom - the location of the first element (< 0 not to swap)to - the location of the element to swap with (-2 to roll back, -1 to roll forward)roll - if should roll from end to startcopy - return a copy of of the array
public static boolean[] swapArray(boolean[] array,
int from,
int to,
boolean roll,
boolean copy)
array - the array of arrayfrom - the location of the first element (< 0 not to swap)to - the location of the element to swap with (-2 to roll back, -1 to roll forward)roll - if should roll from end to startcopy - return a copy of of the array
public static java.lang.Object[] swapArray(java.lang.Object[] array,
int from,
int to,
boolean roll,
boolean copy)
array - the array of arrayfrom - the location of the first element (< 0 not to swap)to - the location of the element to swap with (-2 to roll back, -1 to roll forward)roll - if should roll from end to startcopy - return a copy of of the array
public static int[] insertArray(int[] array,
int index,
int elt)
array - the arrayindex - the location where the element must be inserted (use -1 to insert ahead and array.length (or greater) to insert at the end)elt - the element to be inserted
public static boolean[] insertArray(boolean[] array,
int index,
boolean elt)
array - the arrayindex - the location where the element must be inserted (use -1 to insert ahead, array.length (or greater) to insert at the end)elt - the element to be inserted
public static java.lang.Object[] insertArray(java.lang.Object[] array,
int index,
java.lang.Object elt)
array - the arrayindex - the location where the element must be inserted (use -1 to insert ahead, array.length (or greater) to insert at the end)elt - the element to be inserted
public static java.lang.Object[] removeArray(java.lang.Object[] array,
int index)
array - the array of objectindex - the location of the element to be removed from
public static java.lang.Object[] removeArray(java.lang.Object[] array,
java.lang.Object obj)
array - the array of objectobj - the object to be removed
public static int[] removeArray(int[] array,
int index)
array - the array of intindex - the location of the element to be removed from
public static boolean[] removeArray(boolean[] array,
int index)
array - the array of booleanindex - the location of the element to be removed from
public static java.lang.Object[] removeArray(java.lang.Object[] array,
int from,
int to)
array - the array of intfrom - the location of the first element to be removed fromto - the location of the last element to be removed from
public static int[] removeArray(int[] array,
int from,
int to)
array - the array of intfrom - the location of the first element to be removed fromto - the location of the last element to be removed from
public static boolean[] removeArray(boolean[] array,
int from,
int to)
array - the array of booleanfrom - the location of the first element to be removed fromto - the location of the last element to be removed from
public static boolean isSameContent(boolean[] array1,
boolean[] array2)
array1 - a boolean arrayarray2 - a boolean array
public static boolean isSameContent(byte[] array1,
byte[] array2)
array1 - a byte arrayarray2 - a byte array
public static boolean isSameContent(char[] array1,
char[] array2)
array1 - a char arrayarray2 - a char array
public static boolean isSameContent(double[] array1,
double[] array2)
array1 - a double arrayarray2 - a double array
public static boolean isSameContent(float[] array1,
float[] array2)
array1 - a float arrayarray2 - a float array
public static boolean isSameContent(int[] array1,
int[] array2)
array1 - an int arrayarray2 - an int array
public static boolean isSameContent(long[] array1,
long[] array2)
array1 - a long arrayarray2 - a long array
public static boolean isSameContent(short[] array1,
short[] array2)
array1 - a short arrayarray2 - a short array
public static boolean isSameContent(java.lang.Object[] array1,
java.lang.Object[] array2)
array1 - an object arrayarray2 - an object array
public static boolean isSameContent(java.util.Set set1,
java.util.Set set2)
set1 - a Setset2 - a Set
public static boolean isSameContent(java.util.List list1,
java.util.List list2)
list1 - a Listlist2 - a List
public static boolean isSameContent(java.util.Map map1,
java.util.Map map2)
map1 - a Mapmap2 - a Map
public static boolean isSameContent(java.lang.String str1,
java.lang.String str2)
str1 - a Stringstr2 - a String
public static boolean isSameContent(java.util.Date date1,
java.util.Date date2)
date1 - a Datedate2 - a Date
public static boolean isSameContent(org.jdom.Element elt1,
org.jdom.Element elt2)
elt1 - a JDom Elementelt2 - a JDom Element
public static java.util.TreeSet getTreeDescendantSet(TreeNode node)
node - the node
public static java.util.Set getTreeDescendantSet(TreeNode node,
java.util.Set nodeSet)
public static java.util.TreeSet getAllChildrenSet(TreeNode node)
node - the node
public static java.util.Set getAllChildren(TreeNode node,
java.util.Set nodeSet)
node - the parent nodenodeSet - the set to fill, if null, returns null
public static boolean isChildNode(TreeNode node,
TreeNode child)
node - the parent nodechild - the node to seek
public static java.lang.String getHtmlIcon(java.lang.String src,
java.lang.String alt)
src - the image sourcealt - the iamge title
public static boolean notEmpty(java.lang.String s)
true if this string is not null
nor empty (once trimmed).
s - the string to test
public static boolean isEmpty(java.lang.String s)
true if this string is null or
empty (once trimmed).
s - the string to test
public static int[] splitToIntArray(java.lang.String str,
java.lang.String delim)
str - the String to splitdelim - the delimiter (same as StringTokenizer)
splitToList(String, String),
StringTokenizer
public static java.lang.String[] split(java.lang.String str,
java.lang.String delim)
str - the String to splitdelim - the delimiter (same as StringTokenizer)
splitToList(String, String),
StringTokenizer
public static java.util.ArrayList<java.lang.String> splitToList(java.lang.String str,
java.lang.String delim)
str - the String to splitdelim - the delimiter (same as StringTokenizer)
StringTokenizer
public static java.lang.String[] split(java.lang.String str,
char delim,
java.lang.String emptyToken)
str - the String to splitdelim - the delimiteremptyToken - the value to used when encounter an empty token
public static java.lang.String trimEnd(java.lang.String str)
str - the String to trim
public static java.lang.String[] splitWithPattern(java.lang.String text,
java.lang.String pattern)
text: foo [one: 1] [two: 2] bar [three: 3] barpattern: "\\[([^\\]]+)\\]"String[] {"one: 1", "two: 2", "three: 3" }text: foo [one: 1] [two: 2] bar [three: 3] barpattern: "\\[[^\\]]+\\]"String[] {"[one: 1]", "[two: 2]", "[three: 3]" }
text - the text to split.pattern - the pattern to split with.
public static java.lang.String getMatch(java.lang.String regexp,
java.lang.String str,
int group)
regexp - the regular expressionstr - the String to matchgroup - the group to match
public static java.lang.String getMatch(java.util.regex.Pattern pattern,
java.lang.String str,
int group)
pattern - java.util.regex.Patternstr - the String to matchgroup - the group to match
public static java.lang.String wordWrap(java.lang.String str,
int width)
Wraps a single line of text, identifying words by ' '.
New lines will be separated by the system property line separator. Very long words, such as URLs will not be wrapped.
Leading spaces on a new line are stripped. Trailing spaces are not stripped.
Util.wordWrap(null, *) = null
Util.wordWrap("", *) = ""
str - the String to be word wrapped, may be nullwidth - the column to wrap the words at, less than 1 is treated as 1
null if null input
TODO: replace with jakarta WordUtils.wrap()
public static java.lang.String wordWrap(java.lang.String str,
int wrapLength,
java.lang.String newLineStr,
boolean wrapLongWords)
Wraps a single line of text, identifying words by ' '.
Leading spaces on a new line are stripped. Trailing spaces are not stripped.
Util.wordWrap(null, *, *, *) = null
Util.wordWrap("", *, *, *) = ""
str - the String to be word wrapped, may be nullwrapLength - the column to wrap the words at, less than 1 is treated as 1newLineStr - the string to insert for a new line,
null uses the system property line separatorwrapLongWords - true if long words (such as URLs) should be wrapped
null if null input
TODO: replace with jakarta WordUtils.wrap()public static void mainTestGeneratePassword(java.lang.String[] args)
public static void mainTestJoin(java.lang.String[] args)
public static java.lang.String join(java.lang.Object[] array,
java.lang.String sep)
array - the array of String to join.sep - the separator
public static java.lang.String join(java.lang.Object[] array,
java.lang.String sep,
int max,
java.lang.String suffix)
array - the array of String to join.sep - the separatormax - the maximum of item to joinsuffix - the suffix to add if the maximum has been reached
public static java.lang.String join(int[] array,
java.lang.String sep)
array - the array of int to join.sep - the separator
public static java.lang.String join(int[] array,
java.lang.String sep,
int max,
java.lang.String suffix)
array - the array of int to join.sep - the separatormax - the maximum of item to joinsuffix - the suffix to add if the maximum has been reached
public static java.lang.String join(java.lang.String... str)
public static java.lang.String join(long[] array,
java.lang.String sep)
array - the array of long to join.sep - the separator
public static java.lang.String join(long[] array,
java.lang.String sep,
int max,
java.lang.String suffix)
array - the array of long to join.sep - the separatormax - the maximum of item to joinsuffix - the suffix to add if the maximum has been reached
public static java.lang.String join(double[] array,
java.lang.String sep)
array - the array of long to join.sep - the separator
public static java.lang.String join(double[] array,
java.lang.String sep,
int max,
java.lang.String suffix)
array - the array of double to join.sep - the separatormax - the maximum of item to joinsuffix - the suffix to add if the maximum has been reached
public static java.lang.String join(boolean[] array,
java.lang.String sep)
array - the array of boolean to join.sep - the separator
public static java.lang.String join(boolean[] array,
java.lang.String sep,
int max,
java.lang.String suffix)
array - the array of boolean to join.sep - the separatormax - the maximum of item to joinsuffix - the suffix to add if the maximum has been reached
public static java.lang.String toWordLine(java.lang.String str)
str - the string to split
public static java.lang.String repeat(java.lang.String pattern,
int count)
count times
pattern - the patterncount - the number of times the pattern must be repeated
public static boolean arrayContains(java.lang.Object[] array,
java.lang.Object key)
array - the array to be searched.key - the value to be searched for.
public static java.lang.String[] trim(java.lang.String[] array)
array - the array to be trimmed
public static java.lang.String[] trimStringArray(java.lang.String[] array)
array - the array to be trimmed
public static <T> java.util.List<T> trimList(java.util.List<T> list)
T - any typelist - the list to be trimmed
public static java.lang.String[] cleanStringArray(java.lang.String[] array)
array - the array to be cleaned
public static java.lang.Object[] cleanObjectArray(java.lang.Object[] array)
array - the array to be cleaned
public static java.lang.String unaccentuate(java.lang.String str)
str - the String to unaccentuate.
public static java.lang.String unaccentuateRegexp(java.lang.String str)
str - the String of the regexp to unaccentuate.
public static java.lang.String recapitalize(java.lang.String str)
str - the String to proceed
public static java.lang.String uncapitalize(java.lang.String str)
str - the String to proceed
public static java.lang.String asciiIndent(java.lang.String text,
int cols,
int rows,
java.lang.String tailString)
text - the text to indentcols - Number of columnrows - Number of rowstailString - the string to append if the text has been truncated
public static java.lang.String cryptUnix(java.lang.String str)
str - the String to encrypt
public static java.lang.String cryptMD5(java.lang.String str)
str - the String to encrypt
public static java.lang.String encodeBASE64(java.lang.String str)
str - the String to encode
public static java.lang.String encodeBASE64(java.lang.String str,
boolean isChunck)
str - the string to encodeisChunck - - if true this encoder will chunk the base64 output into 76 character blocks
public static java.lang.String decodeBASE64(java.lang.String str)
str - the String to decode
public static java.lang.String encryptDES3(java.lang.String clearStr)
throws StringEncrypter.EncryptionException
StringEncrypter with an internal key.
clearStr - the string to encrypt.
StringEncrypter.EncryptionException - if the encryption could not be performed
public static java.lang.String decryptDES3(java.lang.String encryptedStr)
throws StringEncrypter.EncryptionException
StringEncrypter using same internal key
used by encryptDES3(String).
encryptedStr - the encrypted string to decrypt.
if null or empty, the return
StringEncrypter.EncryptionException - if the decryption could not be performedpublic static java.lang.String conceal(java.lang.String clearStr)
clearStr - the String to encrypt
public static java.lang.String reveal(java.lang.String concealedStr)
concealedStr - the String to encrypt
public static java.lang.String buildID(java.lang.String str,
java.lang.String charRange)
str - the String to used as base for the IDcharRange - a perl5 char range. All the chars out of this
range will be ignored (e.g. "0-9a-z_A-Z" to keep only alpha-num
chars)
public static java.lang.String buildID(java.lang.String str)
str - the String to used as base for the ID
public static java.lang.String buildCamelID(java.lang.String str)
str - the String to used as base for the ID
public static java.lang.String buildUID(java.lang.String str,
java.util.Set<java.lang.String> strSet)
str - the String to used as base for the IDstrSet - the set of String of existing ids
public static void mainTestBuildID(java.lang.String[] args)
public static java.lang.String escapePercent(java.lang.String url)
url - the utf-8 string to escape
public static java.lang.String escapeRegexp(java.lang.String string)
string - the regexp string to be escaped
escapeRegexp(String,boolean)
public static java.lang.String escapeRegexp(java.lang.String string,
boolean basicRegexp)
string - the regexp string to be escapedbasicRegexp - if true convert * and ? to Perl5 regular expression
public static java.lang.String escapeChars(java.lang.String str,
java.lang.String charsToEscape)
Example:
Util.escapeChar("ab|cde%fg|hi=j", "|="); // -> ab%7ccde%25fg%7chi%3dj
str - the stringcharsToEscape - a string containing all the chararacters to escape
charToEscape escapedpublic static java.lang.String unescapeChar(java.lang.String str)
Example:
Util.unescapeChar("ab%7ccde%25fg%7chij"); // -> ab|cde%fg|hij
str - the string
charToUnescape unescapedpublic static java.lang.String escapeLuceneQuery(java.lang.String str)
str - the string to escape
public static void mainTestEscapeLuceneQuery(java.lang.String[] args)
public static java.lang.String replace(java.lang.String str,
java.lang.String match,
java.lang.String rep)
str - the input Stringmatch - a Perl5 regexprep - a Perl5 replace pattern
public static java.lang.String replace(java.lang.String str,
java.lang.String pattern)
str - the input Stringpattern - the Perl5 substitution pattern (e.g. s!regexp!replace!)
public static java.lang.String replace(java.lang.String text,
java.lang.String regexp,
RegexpSubstitution substitution)
throws org.apache.oro.text.regex.MalformedPatternException
text - the textregexp - the regexpsubstitution - the RegexpSubstitution function called.
org.apache.oro.text.regex.MalformedPatternException
public static java.lang.String replace(java.lang.String text,
org.apache.oro.text.regex.Pattern pattern,
RegexpSubstitution substitution)
text - the textpattern - the patternsubstitution - the RegexpSubstitution function called.
public static java.lang.String replaceAll(java.lang.String input,
java.lang.String searchString,
java.lang.String replaceString)
input - represents input stringsearchString - represents substring for replacereplaceString - represents replaced string value
public static java.lang.String removeBlankLines(java.lang.String str)
str - the String to be cleaned
public static java.lang.String escapeBackslash(java.lang.String str)
str - the String to escape
public static java.lang.String removeJavaScriptQuote(java.lang.String str)
str - the String to escape
public static java.lang.String encodeJavaScriptQuote(java.lang.String str)
str - the String to encode
public static java.lang.String escapeJavaScriptQuote(java.lang.String str)
str - the String to escape
public static java.lang.String escapeJavaStringChar(java.lang.String str)
str - the String to escape
public static java.lang.String getFirstSentences(java.lang.String text,
int limit)
text - the string to get the first sentence.limit - how many sentences to get (return the original text if limit <0).
public static void mainSwapArray(java.lang.String[] args)
public static void mainRemoveArray(java.lang.String[] args)
public static java.lang.String truncateHtml(java.lang.String text,
int length,
boolean trim)
text - the HTML content to be truncatedlength - the length to keep.trim - if true trims the input text
public static java.lang.String truncate(java.lang.String str,
int length)
str - the String to truncatelength - the length to truncate to
public static java.lang.String truncate(java.lang.String str,
int length,
java.lang.String suffix)
str - the String to truncatelength - the length to truncate tosuffix - the suffix to add if the string has been truncated
public static java.lang.String html2Ascii(java.lang.String text)
text - the text to convert
public static java.lang.String surround(java.lang.String inside,
java.lang.String begin,
java.lang.String end)
inside - The text to be surrounded.begin - The text at the beginning.end - The text at the end.
public static java.lang.String surroundWithTag(java.lang.String inside,
java.lang.String tag)
inside - The text to be surrounded.tag - The tag
public static java.lang.String decodeUrl(java.lang.String str)
public static java.lang.String encodeUrl(java.lang.String s)
URLEncoder.encode(String, String),
but space is encoded with %20 and '/' is not encoded.
s - String to be translated.
String.
public static java.lang.String encodeUrl(java.lang.String s,
java.lang.String enc)
URLEncoder.encode(String, String),
but space is encoded with %20 and '/' is not encoded.
s - String to be translated.enc - String encoding
String.public static java.lang.String encodeCookie(java.lang.String src)
public static java.lang.String decodeCookie(java.lang.String src)
public static java.lang.String isoLatin1ToEntities(java.lang.String src)
src - the String to convert
public static java.lang.String entitiesToIsoLatin1(java.lang.String src)
src - the String to convert
public static java.lang.String encodeHtmlBasicEntities(java.lang.String src)
src - the String to convert
public static java.lang.String decodeHtmlBasicEntities(java.lang.String src)
src - the String to convert
public static java.lang.String performEncoding(java.lang.String src,
java.util.HashMap transMap)
src - the String to converttransMap - the translation map
public static java.lang.String performDecoding(java.lang.String src,
java.util.HashMap transMap)
src - the String to converttransMap - the translation map
public static java.lang.String performEncodeDecode(java.lang.String src,
java.util.HashMap transMap,
boolean decode)
src - the String to converttransMap - the translation mapdecode - if true use values else use keys
public static java.lang.String encodeIntArray(int[] array)
public static int[] decodeIntArray(java.lang.String param)
public static java.lang.String encodeIntArray(int[] array,
char separator)
public static int[] decodeIntArray(java.lang.String param,
char separator)
public static java.lang.String encodeStringArray(java.lang.String[] array)
public static java.lang.String[] decodeStringArray(java.lang.String param)
public static java.lang.String encodeStringArray(java.lang.String[] array,
char separator)
public static java.lang.String[] decodeStringArray(java.lang.String param,
char separator)
public static java.lang.String encodeObject(java.lang.Object obj)
obj - the object to be encoded
public static java.lang.Object decodeObject(java.lang.String encoded)
encoded - the String that contains the encoded object
public static boolean isNumber(java.lang.String str)
str - the String to be checked
public static int[] toIntArray(java.lang.Object[] objs,
int def)
String or a Integer) to a int
objs - the object array to convertdef - default int value to use is object is empty, not a String nor a Integer
int[] or null if objs is nulltoInt(Object, int)
public static int toInt(java.lang.Object obj,
int def)
String or a Integer) to a int
obj - the object to convertdef - default int value to use is object is empty, not a String nor a Integer
int
public static float toFloat(java.lang.Object obj,
float def)
String or a Float) to a float
obj - the object to convertdef - default float value to use is object is empty, not a String nor a Float
float
public static byte toByte(java.lang.Object obj,
byte def)
String or a Byte) to a byte
obj - the object to convertdef - default byte value to use is object is empty, not a String nor a Byte
byte
public static short toShort(java.lang.Object obj,
short def)
String or a Short) to a short
obj - the object to convertdef - default short value to use is object is empty, not a String nor a Short
short
public static long toLong(java.lang.Object obj,
long def)
String or a Long) to a long
obj - the object to convertdef - default long value to use is object is empty, not a String nor a Long
long
public static double toDouble(java.lang.Object obj,
double def)
String or a Double) to a double
obj - the object to convertdef - default double value to use is object is empty, not a String nor a Double
double
public static char toChar(java.lang.Object obj,
char def)
String or a Character) to a char
obj - the object to convertdef - default char value to use is object is empty, not a String nor a Character
char
public static boolean toBoolean(java.lang.Object obj,
boolean def)
obj - the object to convertdef - default boolean value to use is object is empty, not a String nor a Boolean
boolean
public static java.util.Date toDate(java.lang.String str,
java.lang.String format,
java.util.Locale loc,
java.util.Date def)
str - the String to parseformat - the date Format (can be null)loc - the Locale tio use (can be null)def - the default Date to return if errors append.
public static java.util.Locale toLocale(java.lang.String str,
java.util.Locale def)
public static java.lang.String formatSize(long size,
java.util.Locale locale)
size - the size to formatlocale - the locale to use for the unit
public static java.lang.String formatFileSize(long size)
The format used is plain text.
size - the size to format
public static java.lang.String formatFileSize(long size,
java.util.Locale locale)
The format used is HTML (with detailled abbreviations).
size - the size to formatlocale - the locale to use for the unit
public static java.lang.String formatFileSize(long size,
java.util.Locale locale,
boolean htmlDisplay)
size - the size to formatlocale - the locale to use for the unithtmlDisplay - if true, uses an html format, with detailled abbreviation, otherwise, use only plain text
@Deprecated
public static java.lang.String formatDuration(java.util.Date begin,
java.util.Date end)
DateUtil.formatDuration(Date,Date) instead
begin - the begin dateend - the end date
@Deprecated
public static java.lang.String formatDuration(java.util.Date begin,
java.util.Date end,
java.util.Locale locale)
DateUtil.formatDuration(Date,Date,Locale) instead
begin - the begin dateend - the end datelocale - the locale to use
@Deprecated public static java.lang.String formatDuration(long time)
DateUtil.formatDuration(long) instead
time - the duration to format (in milliseconds)
@Deprecated
public static java.lang.String formatDuration(long time,
java.util.Locale locale)
DateUtil.formatDuration(long,Locale) instead
time - the duration to format (in milliseconds)locale - the locale to use
@Deprecated public static void mainTestFormatDuration(java.lang.String[] args)
DateUtil.mainTestFormatDuration(String[]) instead
@Deprecated public static long roundDuration(long duration)
DateUtil.roundDuration(long) instead
As of current implementation, the following rules are applied
Util.formatDuration(Util.roundDuration(38000)); // 38 s => 38 s Util.formatDuration(Util.roundDuration(76000)); // 1 min 16 s => 1 min 16 s Util.formatDuration(Util.roundDuration(1564512)); // 26 min 4 s => 26 min Util.formatDuration(Util.roundDuration(5890000)); // 1 h 38 min 10 s => 1 h 38 min Util.formatDuration(Util.roundDuration(33165000)); // 9 h 12 min 45 s => 9 h Util.formatDuration(Util.roundDuration(35025000)); // 9 h 43 min 45 s => 10 h Util.formatDuration(Util.roundDuration(130993000)); // 1 day 12 h 23 min 13 s => 1 day 12 h Util.formatDuration(Util.roundDuration(236158000)); // 2 days 17 h 35 min 58 s => 2 days 18 h Util.formatDuration(Util.roundDuration(731675000)); // 8 days 11 h 14 min 35 s => 8 days Util.formatDuration(Util.roundDuration(5934547000L)); // 68 days 16 h 29 min 7 s => 68 days
duration - a duration in milliseconds
public static java.lang.String generatePassword()
public static java.lang.String generatePassword(int length)
public static java.lang.String generatePronounceablePassword(int pwdLength)
pwdLength - The length of the password to be generated
public static java.lang.String getStackTrace(java.lang.Throwable throwable)
throwable - the exception or throwable to print
public static java.lang.String getCurrentStackTrace()
public static boolean forceFullGarbageCollection(long timeout)
timeout - in millisecond if timeout is reached stop the GC forcing
public static java.lang.String getClassShortName(java.lang.Object object)
object - the object
public static java.lang.String getClassShortName(java.lang.Class clazz)
clazz - the class
public static java.lang.String getClassShortName(java.lang.String fullname)
fullname - the full class name
public static java.util.Set<java.lang.String> getClassFiles(java.lang.String realPath,
java.lang.String fullname,
boolean java)
realPath - the Webapp realpath (i.e. C:/project/appserver/webapps/webapp-name)fullname - the Class fullname (i.e. com.jalios.jcms.Category)java - boolean true to include java file
public static java.lang.String getClassNameFromFilename(java.lang.String filename)
filename - the filename of the class
null if an error occurred.
public static java.lang.Class getFirstCommonClass(java.lang.Class parent,
java.lang.Class child)
parent - child -
public static java.util.List getSuperclassList(java.lang.Class clazz,
java.lang.Class ancestor,
boolean addClass,
boolean addAncestor)
clazz - the class to extract the ancestorsancestor - the greater ancestoraddClass - if true, add the class in the listaddAncestor - if true, add the ancestor in the list
public static java.lang.String escapeHtml(java.lang.String str)
str - the string to escape
public static java.lang.String escapeHtmlQuote(java.lang.String str)
str - the String to escape
public static java.lang.String escapeInputQuote(java.lang.String str)
str - the string to escape, e.g. : 'Hello "World" !'
Hello "World" !'
public static int indexOf(java.lang.Object elem,
java.lang.Object[] array)
elem - an object.array - an array that may contain elem
Object.equals(Object)@Deprecated public static java.lang.String formatIso8601Date(java.util.Date date)
DateUtil.formatIso8601Date(Date) instead
1999-01-01T14:07:00+0100).
date - the date to format.
DateUtil.parseIso8601Date(String)@Deprecated public static java.util.Date parseIso8601Date(java.lang.String source)
DateUtil.parseIso8601Date(String) instead
1999-01-01T14:07:00+0100).
source - the string to be parsed
DateUtil.formatIso8601Date(Date)@Deprecated public static java.lang.String formatW3cDate(java.util.Date date)
DateUtil.formatW3cDate(Date) instead
1999-01-01T14:07:00+01:00).
date - the date to format.
DateUtil.parseW3cDate(String)@Deprecated public static java.util.Date parseW3cDate(java.lang.String source)
DateUtil.parseW3cDate(String) instead
1999-01-01T14:07:00+01:00).
source - the string to be parsed
DateUtil.formatW3cDate(Date)@Deprecated public static java.lang.String formatRfc822Date(java.util.Date date)
DateUtil.formatRfc822Date(Date) instead
Fri, 1 Jan 1999 14:07:00 +0100).
For more details, see http://www.w3.org/Protocols/rfc822/rfc822.txt section 5.1
date - the date to format.
@Deprecated public static java.util.Date parseRfc822Date(java.lang.String source)
DateUtil.parseRfc822Date(String) instead
source - the string to be parsed
@Deprecated public static java.lang.String formatNoSpaceDate(java.util.Date date)
DateUtil.formatNoSpaceDate(Date) instead
date - the date to format.
@Deprecated public static java.util.Date parseNoSpaceDate(java.lang.String source)
DateUtil.parseNoSpaceDate(String) instead
source - the string to be parsed
@Deprecated public static boolean isToday(java.util.Date date)
DateUtil.isToday(Date) instead
date - the date to check
@Deprecated public static boolean isYesterday(java.util.Date date)
DateUtil.isYesterday(Date) instead
date - the date to check
@Deprecated public static boolean isTomorrow(java.util.Date date)
DateUtil.isTomorrow(Date) instead
date - the date to check
@Deprecated
public static boolean isSameDay(java.util.Date date1,
java.util.Date date2)
DateUtil.isSameDay(Date,Date) instead
date1 - the first date to checkdate2 - the second date to check
public static boolean hasAppenderDefined(org.apache.log4j.Logger logger)
Logger has any appender defined.
logger - the Logger to check
@Deprecated public static java.util.Date getNewDateWithoutMillis()
DateUtil.getNewDateWithoutMillis() instead
public static boolean validateRegexp(java.lang.String regexp)
regexp - The pattern to validate
public static java.lang.String reduceBlankLines(java.lang.String text)
text - the original text
public static java.lang.String randomString(int length)
public static int exec(java.lang.String... cmdarray)
throws java.io.IOException,
java.lang.InterruptedException
cmdarray - array containing the command to call and its arguments.
java.io.IOException
java.lang.InterruptedException
public static int exec(java.lang.String[] cmdarray,
java.io.OutputStream stdout,
java.io.OutputStream stderr)
throws java.io.IOException,
java.lang.InterruptedException
cmdarray - array containing the command to call and its arguments.stdout - the OutputStream for stdout (ignored if null)stderr - the OutputStream for stderr (ignored if null)
java.io.IOException
java.lang.InterruptedException
public static int exec(java.lang.String[] cmdarray,
java.lang.StringBuilder stdout,
java.lang.StringBuilder stderr)
throws java.io.IOException,
java.lang.InterruptedException
cmdarray - array containing the command to call and its arguments.stdout - the result of the stdout (ignored if null)stderr - the result of the stderr (ignored if null)
java.io.IOException
java.lang.InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||