com.pow2.util
Class Util

java.lang.Object
  extended bycom.pow2.util.Util

public class Util
extends Object

Utility class.

Author:
Luca Fossato

Constructor Summary
Util()
           
 
Method Summary
static String addURLParameter(String URL, String parameter)
          Add a new parameter to the input URL string representation.
static String addURLParameter(String URL, String paramName, String paramValue)
          Add a new parameter to the input URL string representation.
static String dbString(String v)
          Delimit the input string with single quote characters (').
static String dumpHashTable(Hashtable table, boolean html)
          Dump the content of the input hash table.
static String getLastToken(String str, String tokenSeparator)
          Get the last token from the input string.
static boolean isNull(String s)
          Test if the input string is null or empty (has 0 characters)
static boolean isNull(String s, String val)
          Test if the input string is null or empty or if it's equal to the input val parameter.
static String remove(String str, String until)
          Remove the substring starting from the first character of the input string to the input until string included.
static String stackTrace(Throwable t)
          Return the string representation of the input exception stack trace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

getLastToken

public static String getLastToken(String str,
                                  String tokenSeparator)
Get the last token from the input string.

Parameters:
str - the string containing the token
tokenSeparator - the token separator string (i.e.: "'", ":", etc)
Returns:
the last token from the input string

isNull

public static boolean isNull(String s)
Test if the input string is null or empty (has 0 characters)

Parameters:
s - the input string to test
Returns:
true if the input string is null; false otherwise

isNull

public static boolean isNull(String s,
                             String val)
Test if the input string is null or empty or if it's equal to the input val parameter.

Parameters:
s - the input string to test
val - the value string to compare to s
Returns:
true if s is null, or empty, or if it's equal to the val string; false otherwise.

stackTrace

public static String stackTrace(Throwable t)
Return the string representation of the input exception stack trace.

Parameters:
t - the input throwable object
Returns:
the string representation of the stack trace of the input throwable object

dbString

public static String dbString(String v)
Delimit the input string with single quote characters (').

Parameters:
v - The new string value
Returns:
the input string delimited with single quote characters;

dumpHashTable

public static String dumpHashTable(Hashtable table,
                                   boolean html)
Dump the content of the input hash table.

Parameters:
table - table the hash table to dump
html - true to set the eof as "
\n", false to set it as "\n"
Returns:
Description of the Return Value

addURLParameter

public static String addURLParameter(String URL,
                                     String paramName,
                                     String paramValue)
Add a new parameter to the input URL string representation.

Parameters:
URL - the URL string representation
paramName - the parameter name
paramValue - the parameter value

addURLParameter

public static String addURLParameter(String URL,
                                     String parameter)
Add a new parameter to the input URL string representation.

Parameters:
URL - the URL string representation
parameter - the parameter string, encoded as "${paramName}=${paramValue}"

remove

public static String remove(String str,
                            String until)
Remove the substring starting from the first character of the input string to the input until string included.

Parameters:
str - the string to process
until - the string to reach (it will removed, too)
Returns:
the substring starting from the first characther after the input until string, or null if until token isn't found


Copyright © 2002-2004 Power Of Two S.R.L. All Rights Reserved.