java.lang.Object | +--com.ibm.commerce.tools.util.Util
Contains commonly used functions.
Method Summary | |
---|---|
static java.util.Vector |
arrayToVector(java.lang.Object[] arr) Converts an array to a vector of string. |
static boolean |
compareStrings(java.lang.String x, java.lang.String y) Compares the two strings after any space is trimmed. |
static java.lang.String |
convertFilename(java.lang.String filename) Converts separators '/' and '.' to File.separator. |
static boolean |
convertToBoolean(java.lang.Object value) Converts the given string to a boolean value. |
static java.util.Hashtable |
convertToHashtable(java.lang.Object key,
java.lang.Object x) Converts an object to a Hashtable . |
static java.util.Vector |
convertToVector(java.lang.Object x) Converts an object to a Vector . |
static java.io.File |
copyFile(java.lang.String fileInput,
java.lang.String fileOutput) Makes a copy of input file to an output file. |
static java.util.Hashtable |
copyHashtable(java.util.Hashtable table) Makes a recursive copy of a hashtable. |
static java.util.Vector |
copyVector(java.util.Vector v) Makes a recursive copy of a vector. |
static java.io.File |
findFile(java.lang.String filename, java.lang.String path) Searches the given path for the given file name. |
static java.util.Hashtable |
flatten(java.util.Hashtable h1, java.util.Hashtable h2) Consolidates the given hashtables into a single hashtable. |
static java.util.Hashtable |
getAllRoles() Reads all roles (member groups) from Roles.xml into a hashtable. |
static java.util.Vector |
getRoles(
UserAccessBean uab, java.lang.Long owner_id) Reads the roles for a particular user on a particular store. |
static java.lang.String |
hexToString(java.lang.String text) This method takes a hexadecimal string and returns the corresponding character String object. |
static java.lang.String |
insert(java.lang.String target, java.lang.String insertStr,
int pos) Inserts a given substring at a given position |
static boolean |
isAS400OS() Checks whether the operating system is AS/400. |
static boolean |
isDoubleByteLocale(java.util.Locale locale) Checks to see whether the locale is a double-byte character. |
static boolean |
isIE(HttpServletRequest request) Checks to see whether the browser is Internet Explorer. |
static boolean |
isLowerCase(java.lang.String target) Tests to see if a string is lower case. |
static boolean |
isLowerCase(java.lang.String str, int start, int length) Tests to see if a substring is lower case. |
static boolean |
isNetscape(HttpServletRequest request) Checks to see whether the browser is Netscape. |
static boolean |
isUnixOS() Checks whether the operating system is UNIX. |
static boolean |
isUpperCase(java.lang.String str) Tests to see if a string is upper case. |
static boolean |
isUpperCase(java.lang.String str, int start, int length) Tests to see if a substring is upper case. |
static boolean |
isWindowsOS() Checks whether the operating system is Windows. |
static java.util.Vector |
merge(java.lang.Object value1, java.lang.Object value2) Merges the given objects into a single vector. |
static int |
occurencesOf(java.lang.String target) Returns the number of occurences of " \t\n". |
static int |
occurencesOf(java.lang.String target,
java.lang.String characters) Returns the number of occurences of a substring. |
static java.lang.String |
replace(java.lang.String source, char pattern,
char replacement) Replaces the occurrences of a given pattern character with a given replacement character in the source string. |
static java.lang.String |
replace(java.lang.String source, java.lang.String pattern,
java.lang.String replacement) Replaces the occurrences of a given pattern string with a given replacement string in the source string. |
static java.lang.String |
reverse(java.lang.String source) Returns the reversal of the source string. |
static java.lang.String |
stringToHex(java.lang.String text) Converts the given string to a hexadecimal representation. |
static java.lang.String |
strip(java.lang.String target) Strips the leading and trailing characters. |
static java.lang.String |
stripLeading(java.lang.String target) Strips leading characters " \t\n". |
static java.lang.String |
stripLeading(java.lang.String target,
java.lang.String characters) Strips the given leading characters. |
static java.lang.String |
stripTrailing(java.lang.String target) Strips trailing characters " \t\n". |
static java.lang.String |
stripTrailing(java.lang.String target,
java.lang.String characters) Strips the given trailing characters. |
static java.lang.String[] |
tokenize(java.lang.String source,
java.lang.String delimiter) Tokenizes a string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll,
toString, wait, wait, wait |
Method Detail |
---|
public static final java.util.Vector arrayToVector(java.lang.Object[] arr)
arr
- array to be convertednull
if the array is empty.public static final boolean compareStrings(java.lang.String x, java.lang.String y)
x
- the first stringy
- second stringtrue
if two strings are identical.false
otherwise.public static final java.lang.String convertFilename(java.lang.String filename)
filename
- the original file name.public static final boolean convertToBoolean(java.lang.Object value)
value
- a string or boolean value to be convertedfalse
if the original value is
null
.public static final java.util.Hashtable convertToHashtable(java.lang.Object key, java.lang.Object x)
Hashtable
.
key
- the key associated with the hashtablex
- the object to be convertednull
if x
is null
.x
is an instance of
Hashtable
.key
and x
put into it.public static final java.util.Vector convertToVector(java.lang.Object x)
Vector
.
x
- the object to be convertednull
if x
is null
.x
if x
is an instance of
Vector
.x
put into
it.public static final java.io.File copyFile(java.lang.String fileInput, java.lang.String fileOutput) throws java.io.IOException
fileInput
- source file namefileOutput
- destination file namejava.io.IOException
- If file I/O exeption is
encountered.public static final java.util.Hashtable copyHashtable(java.util.Hashtable table)
table
- the hashtable to be copiedpublic static final java.util.Vector copyVector(java.util.Vector v)
v
- the vector to be copiedpublic static final java.io.File findFile(java.lang.String filename, java.lang.String path)
filename
- the given file name to be searchedpath
- the searching pathnull
if not found.public static final java.util.Hashtable flatten(java.util.Hashtable h1, java.util.Hashtable h2)
h1
- the first hashtableh2
- the second hashtablepublic static final java.util.Hashtable getAllRoles() throws ECSystemException
Hashtable
.
ECSystemException
- If an exception is caught while reading the XML
file.public static final java.util.Vector getRoles(UserAccessBean uab, java.lang.Long owner_id) throws ECSystemException
uab
- the user access beanowner_id
- the owner of the store
ECSystemException
- If error occurs while reading the roles from
database.public static final java.lang.String hexToString(java.lang.String text)
String
object.
text
- the hexadecimal stringpublic static final java.lang.String insert(java.lang.String target, java.lang.String insertStr, int pos)
target
- the target stringinsertStr
- the string to be insertedpos
- the inserted positionpublic static boolean isAS400OS()
true
if it is AS/400.false
otherwise.public static boolean isDoubleByteLocale(java.util.Locale locale)
locale
- the locale to be checkedtrue
if the locale is DBCS. false
otherwise.public static boolean isIE(HttpServletRequest request)
request
- the HTTP requesttrue
if the browser is Internet Explorer; false
otherwise.public static final boolean isLowerCase(java.lang.String target)
target
- the string to be checkedtrue
if the string is lower case; false
otherwise.public static final boolean isLowerCase(java.lang.String str, int start, int length)
str
- the string to be checkedstart
- the start position of the substringlength
- the length of the substring to be checkedtrue
if the string is lower case;false
otherwise or if the string is
null
.public static boolean isNetscape(HttpServletRequest request)
request
- the HTTP requesttrue
if the browser is Netscape; false
otherwise.public static boolean isUnixOS()
true
if it is UNIX; false
otherwise.public static final boolean isUpperCase(java.lang.String str)
str
- the string to be checkedtrue
if the string is upper case; false
otherwise.public static final boolean isUpperCase(java.lang.String str, int start, int length)
str
- the string to be checkedstart
- the start position of the substringlength
- the length of the substring to be checkedtrue
if the string is upper case; false
otherwise
or if the string is null
.public static boolean isWindowsOS()
true
if it is Windows; false
otherwise.public static final java.util.Vector merge(java.lang.Object value1, java.lang.Object value2)
value1
- the first object to be mergedvalue2
- the second object to be mergedpublic static final int occurencesOf(java.lang.String target)
target
- the source stringpublic static final int occurencesOf(java.lang.String target, java.lang.String characters)
target
- the source stringcharacters
- the substring to be searchedpublic static final java.lang.String replace(java.lang.String source, char pattern, char replacement)
source
- the source stringpattern
- the pattern character to be replacedreplacement
- the replacement characterpublic static final java.lang.String replace(java.lang.String source, java.lang.String pattern, java.lang.String replacement)
source
- the source stringpattern
- the pattern string to be replacedreplacement
- the replacement stringpublic static final java.lang.String reverse(java.lang.String source)
source
- the source stringpublic static final java.lang.String stringToHex(java.lang.String text)
text
- the source stringpublic static final java.lang.String strip(java.lang.String target)
target
- the source stringnull
.public static final java.lang.String stripLeading(java.lang.String target)
target
- the source stringpublic static final java.lang.String stripLeading(java.lang.String target, java.lang.String characters)
target
- the source stringcharacters
- the character set to be strippedpublic static final java.lang.String stripTrailing(java.lang.String target)
target
- the source stringpublic static final java.lang.String stripTrailing(java.lang.String target, java.lang.String characters)
target
- the source stringcharacters
- the character set to be strippedpublic static java.lang.String[] tokenize(java.lang.String source, java.lang.String delimiter)
source
- the source stringdelimiter
- the delimiter used