org.cofax
Class CofaxUtil

java.lang.Object
  |
  +--org.cofax.CofaxUtil

public class CofaxUtil
extends java.lang.Object

The general utilities class of Cofax. Routines used across the entire framework are stored here.

Author:
Rajiv Pant, Karl Martino, Sam Cohen

Field Summary
static int COMMON_DATA_SIZE
           
static int MILLISECONDS_PER_MINUTE
           
static java.lang.String newLine
           
static java.lang.String xhtmlNewLine
           
 
Constructor Summary
CofaxUtil()
           
 
Method Summary
static void debug(java.io.PrintWriter out, java.lang.String message)
          Displays the passed in debug message if debugging is turned on
static java.lang.String encodeUrl(java.lang.String url)
          Encodes a string into URL format.
static java.lang.String getDateFormat(java.lang.String style, java.util.Date dateToFormat)
           
static java.lang.String getDateFormat(java.lang.String style, java.lang.String pubDate)
           
static java.lang.String getIntegerAsString(java.util.HashMap fields, java.lang.String fieldName)
          Returns a member of a hashtable as a string
static java.lang.String getString(java.util.HashMap fields, java.lang.String fieldName)
          Returns a member of a hashtable as a string
static boolean isDigits(java.lang.String stringToParse)
          Tests to see if a string is composed only of digits.
static java.lang.String quotemetaLight(java.lang.String s)
          Escapes out (puts a backslash in front of) perl regular expression chars contained in the passed in string.
static java.lang.String replace(java.lang.String originalText, char charToFind, java.lang.String subStringToReplaceWith)
          Replaces all occurances of the specified character with the specified sub-string to replace with.
static java.lang.String replace(java.lang.String originalText, java.lang.String subStringToFind, java.lang.String subStringToReplaceWith)
          Replaces all occurances of the specified sub-string to find with the specified sub-string to replace with.
static java.lang.String replaceToUpper(java.lang.String originalText, java.lang.String subStringToFind, java.lang.String subStringToReplaceWith)
          Replaces all occurances of the specified sub-string to find with the specified sub-string to replace with.
static java.util.List split(java.lang.String separator, java.lang.String str)
          Splits a string and returns a vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MILLISECONDS_PER_MINUTE

public static final int MILLISECONDS_PER_MINUTE

newLine

public static final java.lang.String newLine

xhtmlNewLine

public static final java.lang.String xhtmlNewLine

COMMON_DATA_SIZE

public static final int COMMON_DATA_SIZE
Constructor Detail

CofaxUtil

public CofaxUtil()
Method Detail

isDigits

public static boolean isDigits(java.lang.String stringToParse)
Tests to see if a string is composed only of digits. Note: will return false for "-" and "+".

split

public static java.util.List split(java.lang.String separator,
                                   java.lang.String str)
Splits a string and returns a vector.

encodeUrl

public static final java.lang.String encodeUrl(java.lang.String url)
Encodes a string into URL format.

replace

public static java.lang.String replace(java.lang.String originalText,
                                       char charToFind,
                                       java.lang.String subStringToReplaceWith)
Replaces all occurances of the specified character with the specified sub-string to replace with. This function is written using a char[] array and StringBuffer for efficiency.

replace

public static java.lang.String replace(java.lang.String originalText,
                                       java.lang.String subStringToFind,
                                       java.lang.String subStringToReplaceWith)
Replaces all occurances of the specified sub-string to find with the specified sub-string to replace with.

replaceToUpper

public static java.lang.String replaceToUpper(java.lang.String originalText,
                                              java.lang.String subStringToFind,
                                              java.lang.String subStringToReplaceWith)
Replaces all occurances of the specified sub-string to find with the specified sub-string to replace with.

quotemetaLight

public static java.lang.String quotemetaLight(java.lang.String s)
Escapes out (puts a backslash in front of) perl regular expression chars contained in the passed in string. This version uses the replace(String, char, String) function defined in this class. It does not use a Perl5Util regex object to do its own work. The replace(String, char, String) function uses a character array StringBuffer object.

debug

public static void debug(java.io.PrintWriter out,
                         java.lang.String message)
Displays the passed in debug message if debugging is turned on

getDateFormat

public static java.lang.String getDateFormat(java.lang.String style,
                                             java.lang.String pubDate)

getDateFormat

public static java.lang.String getDateFormat(java.lang.String style,
                                             java.util.Date dateToFormat)

getString

public static java.lang.String getString(java.util.HashMap fields,
                                         java.lang.String fieldName)
Returns a member of a hashtable as a string

getIntegerAsString

public static java.lang.String getIntegerAsString(java.util.HashMap fields,
                                                  java.lang.String fieldName)
Returns a member of a hashtable as a string


Copyright 2001 KnightRidder.com. All Rights Reserved.