|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.infinityloop.util.Utility
public class Utility
Collection of (static) Utility methods.
Constructor Summary | |
---|---|
Utility()
|
Method Summary | |
---|---|
static java.util.Vector |
arr2Vector(java.lang.Object[] arr)
Convert an array to a Vector. |
static void |
benchmark(int repetitions)
|
static java.lang.String |
convertCSS2IdentifierOrString(java.lang.String s)
Converts the passed CSS string to the internal format: unquote, resolve escapes etc. |
static java.util.Stack |
convertHashMapToStack(java.util.HashMap ht)
Converts a HashMap to a Stack of Pair's. |
static java.util.Stack |
convertHashtableToStack(java.util.Hashtable ht)
Converts a Hashtable to a Stack of Pair's. |
static java.util.Stack |
convertHashtableToStackSorted(java.util.Hashtable ht)
Converts a Hashtable to a Stack of Pair's, with sorted keys in natural order. |
static java.lang.String |
convertLineEndings(java.lang.String s,
java.lang.String lineEnding)
Converts the lines in the passed string into a form using the specified line ending string |
static java.util.Hashtable |
convertStackToHashtable(java.util.Vector v)
Converts a Vector of Pair()s to a Hashtable. |
static java.util.Stack |
convertTreeMapToStack(java.util.TreeMap ht)
Converts a TreeMap to a Stack of Pair's. |
static int |
countOccurrences(java.lang.String s,
char c)
Returns the number of occurrences of a specified character in a String. |
static int |
dayDifference(java.util.Calendar one,
java.util.Calendar two)
Calculates the difference in days between the two dates passed in (one - two). |
static void |
debugMessage(java.lang.String msg)
Issue a debug level message to the current active log. |
static void |
errorMessage(java.lang.String msg)
Issue a error level message to the current active log. |
static int |
executeCommand(java.util.Vector theCommand,
boolean wait,
java.lang.StringBuffer stdout,
java.lang.StringBuffer stderr)
executes the passed commandline via Runtime.exec(). |
static java.lang.String |
expandString(java.lang.String src,
java.util.Hashtable variables)
Expands a string that might contain variables. |
static void |
fatalMessage(java.lang.String msg)
Issue a fatal level message to the current active log. |
static java.lang.String |
getCurrentMethodName()
Return the name of the routine that called getCurrentMethodName |
static java.lang.String |
getJREversionString()
Returns the JRE version as in the system property. |
static java.lang.String |
getMangledComponent(int n,
java.lang.String s)
Retrieves the n-th component of a mangled string, with n starting at 0. |
static java.lang.String |
getTimerInfoString()
prints current Timer information |
static int |
hourDifference(java.util.Calendar one,
java.util.Calendar two)
Calculates the difference in days between the two dates passed in (one - two). does not take into account leap years, leap seconds etc. |
static java.lang.String |
indentation(int steps,
java.lang.String indentationElement)
Calculates indentation string based on passed values: (steps * indentatationElement) as String |
static void |
infoMessage(java.lang.String msg)
Issue a info level message to the current active log. |
static boolean |
isDocFile(DiskFile file)
determines if the passed file is a DOC file |
static boolean |
isHexCharacter(char c)
Determines whether the passed character is a hex representation character, i.e. if it is within [0-9A-Fa-f]. |
static boolean |
isRTFFile(DiskFile file)
determines if the passed file is an RTF file |
static boolean |
isWordFile(DiskFile file)
determines if the passed file is a Word document file, i.e. |
static boolean |
isWordFilePlatform(DiskFile file)
determines if the passed file is a readable Word document file, i.e. |
static int |
makeDTTMFromRFCDate(java.lang.String s)
translates an RFC date to DTTM. |
static java.lang.String |
makeRFCDateFromDTTM(int value)
translates a DTTM bitfield to a RFC date. |
static java.lang.String |
makeRFCDateString(java.util.Calendar cld)
Makes an RFC-1123 compliant date from a Java Calendar object. |
static java.lang.String |
makeVersionString(int version)
Tranforms the integer version into a human readable version string. |
static java.lang.String |
makeVersionString(int version,
java.lang.String build)
Tranforms the integer version into a human readable version string, including the build number. |
static java.lang.String |
minimizeWhitespace(java.lang.String src)
Minimizes whitespace in a string, i.e. condenses all whitespace characters to one single WS character. |
static java.lang.String |
parseCSS2Identifier(java.lang.String src)
Parses a CSS2 (class-)identifier, resolving all hex escapes it might have. |
static java.util.Calendar |
parseRFCDateString(java.lang.String date)
Parses an RFC-1123 compliant date string into a Calendar object. |
static void |
resetTimer(java.lang.String key)
resets the timer with name key |
static void |
resetTimers()
resets all timing info |
static java.lang.String[] |
resolveArgumentString(java.lang.String params,
java.util.Vector charsNeedingQuoting)
Resolves a (commandline-) String into an array of Strings with the single arguments. |
static java.lang.String |
resolveExpression(java.lang.String expression,
java.lang.String srcfile,
java.lang.String destDir,
java.lang.String imageDir)
Resolves the passed string, which may contain placeholders, to the final command line. |
static java.lang.String |
resolveNumericalEntities(java.lang.String s)
Replaces numerical entities in the passed string (&#decdigits;) into a Unicode character. |
static java.util.Stack |
resolveParameters(java.lang.String params)
Resolves a string into a Stack of Pair()s of parameter-name, parameter-value. |
static java.lang.String |
setMangledComponent(java.lang.String dest,
int n,
java.lang.String val)
Sets the nth component in the passed string to the indicated value. |
static void |
startTimer(java.lang.String key)
start a cumulative timer of key key |
static long |
stopTimer(java.lang.String key)
stops a cumulative timer of key key and returns the length of the just stopped timing action in milliseconds. |
static java.lang.String |
toHexString(long number,
int length,
boolean truncate)
Converts the passed long to a hex string with the specified length, with leading zeros if necessary. |
static void |
warnMessage(java.lang.String msg)
Issue a warning level message to the current active log. |
static void |
writeTextLinesStringPlatform(java.lang.String s,
java.io.Writer w)
Writes a string containing Java GUI newline characters (\n) to the specified OutputWriter, replacing Java GUI newlines by platform newlines. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Utility()
Method Detail |
---|
public static java.util.Stack convertTreeMapToStack(java.util.TreeMap ht)
public static java.util.Stack convertHashtableToStack(java.util.Hashtable ht)
public static java.util.Stack convertHashMapToStack(java.util.HashMap ht)
public static java.util.Stack convertHashtableToStackSorted(java.util.Hashtable ht)
public static java.util.Hashtable convertStackToHashtable(java.util.Vector v)
public static int countOccurrences(java.lang.String s, char c)
public static java.lang.String makeRFCDateFromDTTM(int value)
DTTM format: wwwyyyyy yyyymmmm dddddhhh hhmmmmmm w day of week (0 Sun - 6 Sat) y year-1900 m month (1-12) d day of month (1-31) h hour 0-23 m minute 0-59 0-5 Minute 0-59 6-10 Hour 0-23 11-15 Day of month 1-31 16-19 Month 1-12 20-28 Year = Year-1900 29-31 Day of week 0 (Sun)-6 (Sat)
public static int makeDTTMFromRFCDate(java.lang.String s)
DTTM format: wwwyyyyy yyyymmmm dddddhhh hhmmmmmm w day of week (0 Sun - 6 Sat) y year-1900 m month (1-12) d day of month (1-31) h hour 0-23 m minute 0-59 0-5 Minute 0-59 6-10 Hour 0-23 11-15 Day of month 1-31 16-19 Month 1-12 20-28 Year = Year-1900 29-31 Day of week 0 (Sun)-6 (Sat)
public static java.lang.String convertCSS2IdentifierOrString(java.lang.String s)
public static java.lang.String parseCSS2Identifier(java.lang.String src)
public static boolean isHexCharacter(char c)
public static int dayDifference(java.util.Calendar one, java.util.Calendar two)
public static int hourDifference(java.util.Calendar one, java.util.Calendar two)
public static java.lang.String indentation(int steps, java.lang.String indentationElement)
steps
- number of steps to indentindentationElement
- for each indentation step, this String is written
public static java.util.Stack resolveParameters(java.lang.String params)
[name '=' '"' value '"']? [ '[;,]' name '=' '"' value '"' ]*
public static java.lang.String[] resolveArgumentString(java.lang.String params, java.util.Vector charsNeedingQuoting)
public static java.util.Vector arr2Vector(java.lang.Object[] arr)
arr
- the Object array
public static java.lang.String getJREversionString()
public static java.lang.String makeRFCDateString(java.util.Calendar cld)
Format: "Wkd, dd Mon yyyy hh:mm:ss GMT"
public static java.util.Calendar parseRFCDateString(java.lang.String date)
Format: "Wkd, dd Mon yyyy hh:mm:ss GMT"
public static java.lang.String makeVersionString(int version)
public static java.lang.String makeVersionString(int version, java.lang.String build)
public static void writeTextLinesStringPlatform(java.lang.String s, java.io.Writer w) throws java.io.IOException
java.io.IOException
public static java.lang.String minimizeWhitespace(java.lang.String src)
public static java.lang.String resolveNumericalEntities(java.lang.String s) throws java.lang.Exception
java.lang.Exception
public static java.lang.String getMangledComponent(int n, java.lang.String s)
public static java.lang.String setMangledComponent(java.lang.String dest, int n, java.lang.String val)
Note: n is 0-based.
public static java.lang.String toHexString(long number, int length, boolean truncate)
public static java.lang.String getCurrentMethodName()
public static void startTimer(java.lang.String key)
public static long stopTimer(java.lang.String key)
public static void resetTimers()
public static void resetTimer(java.lang.String key)
public static java.lang.String getTimerInfoString()
public static boolean isRTFFile(DiskFile file)
file
- the file to test
public static boolean isDocFile(DiskFile file)
file
- the file to test
public static boolean isWordFile(DiskFile file)
file
- the file to test
public static boolean isWordFilePlatform(DiskFile file)
file
- the file to test
public static java.lang.String resolveExpression(java.lang.String expression, java.lang.String srcfile, java.lang.String destDir, java.lang.String imageDir)
expression
- - the String expression to resolvesrcfile
- - the sourcefile of the conversiondestDir
- - the destination directory of the current conversionimageDir
-
public static java.lang.String expandString(java.lang.String src, java.util.Hashtable variables)
Variables not known are left unexpanded.
src
- the source string to expandvariables
- a hashtable of variable name/variable value pairs that should get expanded
public static int executeCommand(java.util.Vector theCommand, boolean wait, java.lang.StringBuffer stdout, java.lang.StringBuffer stderr) throws java.lang.Exception
java.lang.Exception
public static void debugMessage(java.lang.String msg)
msg
- the message to logpublic static void infoMessage(java.lang.String msg)
msg
- the message to logpublic static void errorMessage(java.lang.String msg)
msg
- the message to logpublic static void warnMessage(java.lang.String msg)
msg
- the message to logpublic static void fatalMessage(java.lang.String msg)
msg
- the message to logpublic static java.lang.String convertLineEndings(java.lang.String s, java.lang.String lineEnding)
public static void benchmark(int repetitions)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |