org.jboss.portal.format.util
Class Tools

java.lang.Object
  extended by org.jboss.portal.format.util.Tools

public class Tools
extends java.lang.Object


Field Summary
static org.apache.log4j.Logger log
           
static java.lang.String VMID
          16 chars long VMID.
 
Constructor Summary
Tools()
           
 
Method Summary
static java.util.List explode(java.lang.String content, java.lang.String delimiter)
          Explode the a string according to a delimiter.
static java.lang.String replace(java.lang.String s, java.lang.String source, java.lang.String target)
          Replace occurence in a string.
static void safeClose(java.io.InputStream in)
          Close a stream safely.
static void safeClose(java.io.OutputStream out)
          Close a stream safely.
static void safeClose(java.io.Reader reader)
          Close a stream safely.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final org.apache.log4j.Logger log

VMID

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

Constructor Detail

Tools

public Tools()
Method Detail

replace

public static java.lang.String replace(java.lang.String s,
                                       java.lang.String source,
                                       java.lang.String target)
Replace occurence in a string.

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

explode

public static java.util.List explode(java.lang.String content,
                                     java.lang.String delimiter)
Explode the a string according to a delimiter. The returned value is a List containing the exploded values. If the content parameter does not contain the delimiter , the returned value is a List containing content.

Parameters:
content - the string to explode.
delimiter - the delimiter
Returns:
a List containing the exploded content according the delimiter
Throws:
java.lang.NullPointerException - if content or delimiter is null

safeClose

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

Parameters:
out - the stream to close

safeClose

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

Parameters:
in - the stream to close

safeClose

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

Parameters:
reader - the stream to close