站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.6 API 英文版文档

Tools - JBOSS Portal 2.6 API 英文版文档


org.jboss.portal.migration.helper
Class Tools

java.lang.Object
  extended byorg.jboss.portal.migration.helper.Tools

public class Tools
extends java.lang.Object

Version:
$Revision: 5449 $
Author:
Julien Viet, Thomas Heute

Field Summary
static int DEFAULT_BUFFER_SIZE
           
private static java.lang.Object[] EMPTY_ARGS
           
static java.util.ResourceBundle EMPTY_BUNDLE
           
static java.util.Enumeration EMPTY_ENUMERATION
           
static java.util.Iterator EMPTY_ITERATOR
           
private static java.lang.Class[] EMPTY_PARAMETER_TYPES
           
static org.apache.log4j.Logger log
           
static java.lang.String RE_EMAIL_VALIDATION
           
static java.lang.String VMID
          16 chars long VMID.
 
Constructor Summary
Tools()
           
 
Method Summary
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 void copy(java.io.InputStream in, java.io.OutputStream out)
          Pipe an input stream in an output stream.
static void copy(java.io.InputStream in, java.io.OutputStream out, int bufferSize)
          Pipe an incoming stream in an outcoming stream.
static java.lang.String decodeXWWWFormURL(java.lang.String s)
           
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 java.lang.String encodeXWWWFormURL(java.lang.String s)
           
static boolean exists(java.net.URL url)
           
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 boolean isEmailValid(java.lang.String address)
          Return true is the address is not null and matches the email validation regular expression.
static java.util.Iterator iterator(java.lang.Object o)
           
static java.util.Iterator iterator(java.lang.Object[] objects)
           
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 void safeClose(java.io.InputStream in)
          Close an input stream safely.
static void safeClose(java.lang.Object closable)
          Close an object that implements a close() method.
static void safeClose(java.io.OutputStream out)
          Close an output stream safely.
static void safeClose(java.io.Reader reader)
          Close a reader safely.
static java.util.Enumeration toEnumeration(java.util.Iterator iterator)
           
static java.lang.String toHexString(byte[] bytes)
          Returns a string in the hexadecimal format.
static java.util.List toList(java.util.Enumeration e)
           
static java.util.List toList(java.util.Iterator iterator)
           
static java.util.Set toSet(java.util.Enumeration e)
           
static java.util.Set toSet(java.util.Iterator iterator)
           
static java.util.Set toSet(java.lang.Object[] objects)
           
private static java.lang.String VMID()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

log

public static final org.apache.log4j.Logger log

EMPTY_ARGS

private static final java.lang.Object[] EMPTY_ARGS

EMPTY_PARAMETER_TYPES

private static final java.lang.Class[] EMPTY_PARAMETER_TYPES

RE_EMAIL_VALIDATION

public static final java.lang.String RE_EMAIL_VALIDATION
See Also:
Constant Field Values

VMID

public static final java.lang.String VMID
16 chars long VMID.


EMPTY_ENUMERATION

public static final java.util.Enumeration EMPTY_ENUMERATION

EMPTY_ITERATOR

public static final java.util.Iterator EMPTY_ITERATOR

EMPTY_BUNDLE

public static final java.util.ResourceBundle EMPTY_BUNDLE
Constructor Detail

Tools

public Tools()
Method Detail

safeClose

public static void safeClose(java.lang.Object closable)
Close an object that implements a close() method.

Parameters:
closable - the object to close

safeClose

public static void safeClose(java.io.OutputStream out)
Close an output stream safely.

Parameters:
out - the stream to close

safeClose

public static void safeClose(java.io.InputStream in)
Close an input stream safely.

Parameters:
in - the stream to close

safeClose

public static void safeClose(java.io.Reader reader)
Close a reader safely.

Parameters:
reader - the stream to close

copy

public static void copy(java.io.InputStream in,
                        java.io.OutputStream out)
                 throws java.io.IOException
Pipe an input stream in an output stream.

Parameters:
in - the incoming stream
out - the outcoming stream
Throws:
java.lang.NullPointerException - if an argument is null
java.lang.IllegalArgumentException - if bufferSize < 1
java.io.IOException

copy

public static void copy(java.io.InputStream in,
                        java.io.OutputStream out,
                        int bufferSize)
                 throws java.io.IOException
Pipe an incoming stream in an outcoming stream.

Parameters:
in - the incoming stream
out - the outcoming stream
bufferSize - the buffer size
Throws:
java.lang.NullPointerException - if an argument is null
java.lang.IllegalArgumentException - if bufferSize < 1
java.io.IOException

VMID

private static final java.lang.String VMID()

toEnumeration

public static java.util.Enumeration toEnumeration(java.util.Iterator iterator)

toSet

public static java.util.Set toSet(java.util.Enumeration e)

toList

public static java.util.List toList(java.util.Enumeration e)

toSet

public static java.util.Set toSet(java.lang.Object[] objects)

toSet

public static java.util.Set toSet(java.util.Iterator iterator)

toList

public static java.util.List toList(java.util.Iterator iterator)

iterator

public static java.util.Iterator iterator(java.lang.Object o)

iterator

public static java.util.Iterator iterator(java.lang.Object[] objects)

computeStringHash

public static int computeStringHash(int hash,
                                    java.lang.String s)

encodeXWWWFormURL

public static java.lang.String encodeXWWWFormURL(java.lang.String s)

decodeXWWWFormURL

public static java.lang.String decodeXWWWFormURL(java.lang.String s)

isEmailValid

public static boolean isEmailValid(java.lang.String address)
Return true is the address is not null and matches the email validation regular expression.


md5

public static byte[] md5(java.lang.String text)
Computes an md5 hash of a string.

Parameters:
text - the hashed string
Returns:
the string hash
Throws:
java.lang.NullPointerException - if text is null

md5AsHexString

public static java.lang.String md5AsHexString(java.lang.String text)
Computes an md5 hash and returns the result as a string in hexadecimal format.

Parameters:
text - the hashed string
Returns:
the string hash
Throws:
java.lang.NullPointerException - if text is null

toHexString

public static java.lang.String toHexString(byte[] bytes)
Returns a string in the hexadecimal format.

Parameters:
bytes - the converted bytes
Returns:
the hexadecimal string representing the bytes data
Throws:
java.lang.IllegalArgumentException - if the byte array is null

fromHexString

public static byte[] fromHexString(java.lang.String hex)
Returns a byte array converted from the hexadecimal format.

Parameters:
hex - the string to convert
Returns:
the byte array corresponding
Throws:
java.lang.IllegalArgumentException - if the string is null or does not have the good format

generateTemporaryHash

public static java.lang.String generateTemporaryHash(java.lang.String value,
                                                     long time)

confirmTemporaryHash

public static boolean confirmTemporaryHash(java.lang.String hash,
                                           java.lang.String value,
                                           long time)

buildClassLoaderInfo

public static java.lang.String buildClassLoaderInfo(java.lang.ClassLoader loader)

dumpClassLoaderHierarchyInfo

public static java.lang.String dumpClassLoaderHierarchyInfo(java.lang.ClassLoader loader)

dumpClassLoaderHierarchyInfo

public static void dumpClassLoaderHierarchyInfo(java.io.Writer writer,
                                                java.lang.ClassLoader loader)

dumpClassLoaderHierarchyInfo

public static void dumpClassLoaderHierarchyInfo(org.apache.log4j.Logger log,
                                                java.lang.ClassLoader loader)

dumpClassLoaderHierarchyInfo

public static void dumpClassLoaderHierarchyInfo(org.apache.log4j.Logger log,
                                                org.apache.log4j.Level level,
                                                java.lang.ClassLoader loader)

replace

public static java.lang.String replace(java.lang.String string,
                                       java.lang.String pattern,
                                       java.lang.String replacement)
Replace occurence in a string.

Parameters:
string - the source string
pattern - the replaced pattern
replacement - the replacement text
Returns:
the new string

exists

public static boolean exists(java.net.URL url)