|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.aselect.system.utils.Utils
public class Utils
Static class that implements generic, widely used utility methods.
Description:
The Utils class implements convenient static methods used widely by A-Select
components.
Concurrency issues:
None.
| Constructor Summary | |
|---|---|
Utils()
|
|
| Method Summary | |
|---|---|
static java.util.Hashtable |
convertCGIMessage(java.lang.String xMessage)
Converts a CGI-based String to a hashtable. |
static int |
fromDigit(char ch)
Returns an int from 0 to 15 corresponding to the specified hex digit. |
static java.lang.String |
hashtable2CGIMessage(java.util.Hashtable htInput)
Convert Hashtable to CGI message string. |
static boolean |
matchWildcardMask(java.lang.String s,
java.lang.String sMask)
Compare a string against another string that may contain wildcards. |
static java.lang.String |
prefixString(java.lang.String xPrefix,
java.lang.String xString,
int xEndlength)
Prefixes a String with another String until a specified length is reached. |
static java.lang.String |
replaceString(java.lang.String xSrc,
java.lang.String xString,
java.lang.String xReplaceString)
Replaces all occurences of a string in a source string. |
static byte[] |
stringToHex(java.lang.String xHexString)
Returns a byte array corresponding to a hexadecimal String. |
static java.lang.String |
toHexString(byte[] xBytes)
Outputs a hex-string respresentation of a byte array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Utils()
| Method Detail |
|---|
public static int fromDigit(char ch)
ch - Input hexadecimal character.
java.lang.IllegalArgumentException - on non-hexadecimal characters.public static java.lang.String toHexString(byte[] xBytes)
[0x13, 0x2f, 0x98, 0x76], this method returns a
String object containing "132F9876".
xBytes - Source byte array.
xBytes in
hexadecimal format.public static byte[] stringToHex(java.lang.String xHexString)
"132F9876", this method returns an array
containing [0x13, 0x2f, 0x98, 0x76].xHexString must be a hexadecimal String.
xHexString - String containing a hexadecimal string.
java.lang.IllegalArgumentException - on non-hexadecimal characters.
public static java.lang.String prefixString(java.lang.String xPrefix,
java.lang.String xString,
int xEndlength)
String xVar = "873";
xVar = prefixString("0", xVar, 5);
System.out.println(xVar);
This will print
00873
xPrefix may not be null.
xPrefix - character to prefix xString with.xString - input String.xEndlength - length of desired output String.
public static java.lang.String replaceString(java.lang.String xSrc,
java.lang.String xString,
java.lang.String xReplaceString)
xSrc - The source string.xString - The string that is to be replaced.xReplaceString - The string that replaces xString.
public static java.util.Hashtable convertCGIMessage(java.lang.String xMessage)
key=value&key=value to a hashtable containing the keys and
corresponding values. xMessage).
xMessage - CGI-based input String.
public static java.lang.String hashtable2CGIMessage(java.util.Hashtable htInput)
throws java.io.UnsupportedEncodingException
Hashtable to CGI message string.
Hashtable.Hashtableobjects are synchronized. htInput should be a Hashtable containing valid parameters.
String contains the parameters in CGI syntax.
htInput - The Hashtable to be converted.
htInput.
java.io.UnsupportedEncodingException - If URL encoding fails.
public static boolean matchWildcardMask(java.lang.String s,
java.lang.String sMask)
s against sMask, where
sMask may contain wildcards (* and ?).
s - The string to compare against sMask.sMask - The mask to compare against. May contain wildcards.
true if they match, false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||