|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.UtilFns
Class UtilFns contains various static utility methods.
Field Summary | |
static java.lang.String |
BOOLEAN_FALSE_TEXT
Boolean false text. |
static java.lang.String |
BOOLEAN_TRUE_TEXT
Boolean true text. |
static int |
colorPropertyStringLength
|
static java.lang.String |
DATE_FORMAT_AMPM_STR
DateFormat string, AM/PM clock ("MMM dd yyyy hh:mm:ss a z"). |
static java.lang.String |
DATE_FORMAT_RFC_822_STR
DateFormat string for parsing and formatting RFC-822 date/time values. |
static java.lang.String |
DATE_FORMAT24_STR
DateFormat string, 24-hour clock ("MMM dd yyyy HH:mm:ss z"). |
static java.lang.String |
DEF_SPECIAL_CHARS_STR
String of special characters for 'insertQuoteChars()' method. |
static java.lang.String |
EMPTY_STRING
Empty string. |
static java.lang.String[] |
FAKE_IP_ADDRS
List of IP addresses for 'getLocalHostName()' to try to ignore. |
static java.util.TimeZone |
GMT_TIME_ZONE_OBJ
TimeZone object setup for "GMT". |
static long |
HOURS_PER_DAY
Number of hours in a day (24). |
protected static java.lang.String |
INVALID_FILENAME_CHARS
String of invalid file name characters. |
static long |
MINUTES_PER_DAY
Number of minutes in a day (24 * 60). |
static long |
MINUTES_PER_HOUR
Number of minutes in an hour (60). |
static long |
MS_PER_DAY
Number of milliseconds in an hour (24 * 60 * 60 * 1000). |
static long |
MS_PER_HOUR
Number of milliseconds in an hour (60 * 60 * 1000). |
static long |
MS_PER_MINUTE
Number of milliseconds in an minute (60 * 1000). |
static long |
MS_PER_SECOND
Number of milliseconds in a second (1000). |
static java.lang.String |
newline
A static string containing the proper system-dependent value for the "newline" character sequence. |
static java.lang.String |
QUOTE_STRING
String containing a single double-quote ("). |
static long |
SECONDS_PER_DAY
Number of seconds in a day (24 * 60 * 60). |
static long |
SECONDS_PER_MINUTE
Number of seconds in a minute (60). |
static CfgPropValidator |
timeZoneValidator
|
Method Summary | |
static void |
addDataChangedListener(DataChangedListener listenerObj)
Registers the given 'DataChangedListener' object to be notified when the data such as the default locale is changed. |
protected static void |
addToFileName(java.lang.StringBuffer fileName,
char ch)
Converts the given character to a string that is safe to use in a file name and adds it to the filename. |
static void |
beep()
Emits an audio beep. |
static java.lang.String |
booleanToString(boolean b)
Converts the given boolean value to a string. |
static java.lang.Boolean |
booleanValueOf(boolean b)
Converts the given boolean value to a Boolean. |
static java.lang.Boolean |
booleanValueOf(java.lang.String s)
Converts the given string to a Boolean. |
static java.lang.String |
capFirstLetter(java.lang.String str)
Returns a new version of the given string that has its first character capitialized (if possible). |
static java.lang.String |
charToString(char ch)
Returns a string containing the given single character. |
static java.lang.String |
colorRGBToString(int colorRGBVal)
Converts the given integer color RGB value to a string name corresponding to the color. |
static java.lang.String |
colorRGBToString(int colorRGBVal,
boolean useHexFlag)
Converts the given integer color RGB value to a string name corresponding to the color. |
static java.lang.String |
colorToPropertyString(java.awt.Color colorObj)
Converts the given integer color value to a property string name corresponding to the color. |
static int |
compareVersionStrings(java.lang.String ver1Str,
java.lang.String ver2Str)
Compares two version strings containing version number values separated by periods ('.'). |
static java.lang.String |
createCenteredString(java.lang.String inString,
int fieldLen)
Returns a "centered" version of the given string. |
static java.text.DateFormat |
createDateFormatObj(java.lang.String patternStr)
Creates a 'DateFormat' object and applies the given pattern string to it. |
static java.text.DateFormat |
createDateFormatObj(java.lang.String patternStr,
java.util.Locale localeObj)
Creates a 'DateFormat' object and applies the given pattern string to it. |
static java.text.DateFormat |
createDateFormatObj(java.lang.String patternStr,
java.util.TimeZone timeZoneObj)
Creates a 'DateFormat' object and applies the given pattern string to it. |
static java.text.DateFormat |
createDateFormatObj(java.lang.String patternStr,
java.util.TimeZone timeZoneObj,
java.util.Locale localeObj)
Creates a 'DateFormat' object and applies the given pattern string to it. |
static java.text.NumberFormat |
createFloatNumberFormat()
Creates a float number formatter. |
static java.text.NumberFormat |
createFloatNumberFormat(int numDigits)
Creates a float number formatter. |
static java.text.NumberFormat |
createFloatNumberFormat(int minDigits,
int maxDigits)
Creates a float number formatter. |
static java.text.NumberFormat |
createFloatNumberFormat(int minDigits,
int maxDigits,
java.util.Locale localeObj)
Creates a float number formatter. |
static java.text.NumberFormat |
createFloatNumberFormat(int numDigits,
java.util.Locale localeObj)
Creates a float number formatter. |
static java.text.NumberFormat |
createFloatNumberFormat(java.util.Locale localeObj)
Creates a float number formatter. |
static java.text.NumberFormat |
createFloatNumberFormat(java.lang.String patternStr)
Creates a float number formatter. |
static java.text.NumberFormat |
createFloatNumberFormat(java.lang.String patternStr,
java.util.Locale localeObj)
Creates a float number formatter. |
static java.awt.Color |
createOpaqueColor(java.awt.Color colorObj)
Returns a fully opaque version of the given color (with alpha = 255). |
static java.lang.String |
dateToRFC_822String(java.util.Date date)
Converts the given Date into a RFC-822 date/time string. |
static java.lang.String |
durationMillisToString(long durationMs)
Returns a duration-time string for the given time value. |
static java.lang.String |
durationMillisToString(long durationMs,
boolean showDaysFlag)
Returns a duration-time string for the given time value. |
static java.lang.String |
durationMillisToString(long durationMs,
boolean showDaysFlag,
boolean showSecsFlag)
Returns a duration-time string for the given time value. |
static java.lang.String |
durationMillisToString(long durationMs,
boolean showDaysFlag,
boolean showSecsFlag,
boolean verboseFlag)
Returns a duration-time string for the given time value. |
static java.util.Iterator |
enumToIterator(java.util.Enumeration e)
Converts the enumeration to an iterator. |
static java.lang.String |
enumToListString(java.util.Enumeration e)
Returns a string representation of the data elements referenced by the given enumeration. |
static java.lang.String |
enumToQuotedStrings(java.util.Enumeration enumObj)
Returns a String of substrings gathered from the given enumeration. |
static java.lang.String |
enumToQuotedStrings(java.util.Enumeration enumObj,
char sepChar,
boolean quoteCharsFlag)
Returns a String of substrings gathered from the given enumeration. |
static java.lang.String |
enumToQuotedStrings(java.util.Enumeration enumObj,
java.lang.String sepStr,
boolean quoteCharsFlag)
Returns a String of substrings gathered from the given enumeration. |
static java.lang.String |
enumToString(java.util.Enumeration e)
Returns a string representation of the data elements referenced by the given enumeration. |
static int |
findCharPos(java.lang.String str,
char ch)
Searches the entire given string for the position of the given character. |
static int |
findCharPos(java.lang.String str,
char ch,
int startPos)
Searches the given string for the position of the given character. |
static int |
findCharPos(java.lang.String str,
java.lang.String searchCharsStr)
Searches the given string for the first occurrence of any character in the given search string. |
static int |
findCharPos(java.lang.String str,
java.lang.String searchCharsStr,
int startPos)
Searches the given string for the first occurrence of any character in the given search string. |
static void |
fireDataChanged(java.lang.Object sourceObj)
Called to indicate that this object has changed. |
static java.lang.String |
fixStringLen(java.lang.String inString,
int outLen)
Returns the given string "fixed" to the desired length, truncating or adding spaces as necessary. |
static java.lang.String |
fixStringLen(java.lang.String inString,
int outLen,
boolean rightJustFlag)
Returns the given string "fixed" to the desired length, truncating or adding spaces as necessary. |
static java.lang.String |
fixStringLen(java.lang.String inString,
int outLen,
boolean rightJustFlag,
boolean truncateFlag)
Returns the given string "fixed" to the desired length, (possibly) truncating or adding spaces as necessary. |
static java.lang.String |
floatNumberToPropertyString(java.lang.Object value)
Converts the given float number value to a property string. |
static java.lang.String |
floatNumberToString(double value)
Converts the given float number value to a string where the value displayed will be at least one fractional digit and will always be non-zero as long as the value is greater than zero. |
static java.lang.String |
floatNumberToString(double value,
int digits)
Converts the given float number value to a string. |
static java.lang.String |
floatNumberToString(double value,
int digits,
int columns,
java.lang.Comparable maxValueObj)
Converts the given float number value to a string. |
static java.lang.String |
getColorDisplayName(int value)
Gets the display name for the specifed color value. |
static int |
getColorDisplayNameIndex(int value)
Gets the display name index for the specifed color value. |
static java.lang.String[] |
getColorDisplayNames()
Gets a list of string color display names. |
static int |
getColorDisplayNameValue(int index)
Gets the value for the specified display name index. |
static char |
getDecimalSeparator()
Gets the decimal separator character. |
static java.util.Locale |
getDefaultLocale()
Gets the default locale. |
static java.net.InetAddress |
getLocalHostAddrObj()
Returns an Internet-address object for the local host. |
static java.lang.String |
getLocalHostIP()
Returns the local host IP. |
static java.lang.String |
getLocalHostIP(java.net.InetAddress addrObj)
Returns the local host IP. |
static java.lang.String |
getLocalHostName()
Returns the local host name. |
static java.lang.String |
getLocalHostName(java.net.InetAddress addrObj)
Returns the local host name. |
static java.lang.String |
getMemoryInfoStr()
Returns a string of memory information. |
static java.lang.String |
getPrettyString(java.lang.String str)
Returns a pretty version of the specified string: Capatilizes the first letter of every word. |
static java.lang.String |
getPrettyString(java.lang.String str,
boolean allUpperFlag)
Returns a pretty version of the specified string: Replaces periods with spaces. |
static java.lang.ThreadGroup |
getRootThreadGroupObj()
Returns the root ThreadGroup object. |
static java.lang.String |
getSpacerString(int numSpaces)
Returns a string containing the given number of space characters. |
static java.lang.String |
getStackTraceString(java.lang.Throwable throwObj)
Fetches stack trace data from a throwable and returns it in a string. |
static java.util.Locale |
getSystemLocale()
Gets the system locale. |
static long |
getSystemTimeSec()
Returns the current time in seconds since midnight, January 1, 1970 UTC. |
static java.lang.String |
getTableContentsString(java.util.Map tableObj)
Creates a string of "key" = "value" items from the given table/map, with ", " separating the items. |
static java.lang.String |
getTableContentsString(java.util.Map tableObj,
java.lang.String sepStr)
Creates a string of "key" = "value" items from the given table/map. |
static java.lang.String[] |
getTimeZoneIDs()
Gets all the available time zone IDs supported. |
static int |
getTotalThreadCount()
Returns a count of the total number of threads in the JVM. |
static java.lang.String |
getUserConsoleString()
Inputs a line of data from the user console (System.in). |
static int |
indexOfWhitespace(java.lang.String str)
Searches the given string for the first occurrence of a whitespace character. |
static int |
indexOfWhitespace(java.lang.String str,
int startPos)
Searches the given string for the first occurrence of a whitespace character. |
static java.lang.String |
insertQuoteChars(java.lang.String dataStr,
java.lang.String specialChars)
Returns a string with a backslash quote character ('\') inserted in front of each occurance of a "special" character in the given source string. |
static long |
intTimeToLong(int intTime)
Converts a 32-bit integer value to a 64-bit long as if the value is unsigned. |
static boolean |
isFakeIPAddress(java.lang.String str)
Returns true if the given string contains a "fake" IP address (one that cannot be used as a "real" Internet address). |
static boolean |
isIPAddress(java.lang.String str)
Returns true if the contents of the given string qualify as a valid IP address (in the from #.#.#.#); otherwise returns false. |
static boolean |
isURLAddress(java.lang.String str)
Returns true if the contents of the given string qualify as a valid URL address; otherwise returns false. |
protected static boolean |
isValidFileNameChar(char ch)
Determines if the character is valid for a filename. |
static java.util.Enumeration |
iteratorToEnum(java.util.Iterator it)
Converts the iterator to an enumeration. |
static java.util.Vector |
listStringToVector(java.lang.String str)
Returns a Vector of substrings from the given list string. |
static java.util.Vector |
listStringToVector(java.lang.String str,
char sepChar,
boolean trimFlag)
Returns a Vector of substrings from the given list string. |
static boolean |
moveListElement(java.util.List listObj,
int index,
java.lang.Object element)
Moves the specified element to the specified position in the specified list if it already present, otherwise it adds it at the position. |
static java.lang.String |
normalizeString(java.lang.String str)
Returns a new string with all surrounding whitespace removed and internal whitespace normalized to a single space. |
static Archivable |
parseArchivable(Archivable defaultValueObj,
java.lang.String dataStr)
Converts the given data string to an 'Archivable' object. |
static Archivable |
parseArchivable(java.lang.Class valueClass,
java.lang.String dataStr)
Converts the given data string to an 'Archivable' object. |
static java.awt.Color |
parseColor(java.lang.String colorString)
Converts the given property string name to a color value. |
static int |
parseLeadingInt(java.lang.String numStr)
Parses the leading digits of string as an integer while ignoring any trailing non-digit characters. |
static java.lang.Number |
parseNumber(java.lang.String str)
Converts the given string to a 'Number' object. |
static java.lang.Number |
parseNumber(java.lang.String str,
java.lang.Class valueClass)
Converts the given string to a 'Number' object. |
static java.lang.Object |
parseObject(java.lang.Class valueClass,
java.lang.String dataStr)
Converts the given data string to an object. |
static java.lang.Object |
parseObject(java.lang.Object defaultValueObj,
java.lang.String dataStr)
Converts the given data string to an object. |
static java.lang.String[] |
parseSeparatedSubstrings(java.lang.String dataStr,
java.lang.String sepStr)
Parses a string of substrings using the given separator. |
static java.util.Date |
parseStringToDate(java.lang.String s)
Parses the given time value string using the 24-hour clock format and the local time zone. |
static java.util.Date |
parseStringToDate(java.lang.String s,
boolean gmtFlag)
Parses the given time value string using the 24-hour clock format. |
static java.util.Date |
parseStringToDate(java.lang.String dateStr,
boolean gmtFlag,
boolean amPmFlag)
Parses the given time value string. |
static java.util.TimeZone |
parseTimeZoneID(java.lang.String id)
Parses the time zone ID property. |
static java.lang.Integer[] |
parseVersionNumbers(java.lang.String verStr)
Parses a version string into integer values. |
static java.util.Vector |
quotedStringsToVector(java.lang.String str)
Returns a Vector of substrings from the given string. |
static java.util.Vector |
quotedStringsToVector(java.lang.String str,
char sepChar)
Returns a Vector of substrings from the given string. |
static java.util.Vector |
quotedStringsToVector(java.lang.String str,
char sepChar,
boolean strictFlag)
Returns a Vector of substrings from the given string. |
static java.util.Vector |
quotedStringsToVector(java.lang.String str,
java.lang.String sepCharsStr,
boolean strictFlag)
Returns a Vector of substrings from the given string. |
static void |
removeDataChangedListener(DataChangedListener listenerObj)
Unregisters the given 'DataChangedListener' object from the list of listeners for data. |
static java.util.Vector |
removeEmptyStrings(java.util.Vector vec)
Removes items from the given Vector that are empty string or null. |
static java.lang.String |
removeQuoteChars(java.lang.String dataStr)
Removes the backslash quote characters ('\') put in by 'insertQuoteChars()'. |
static java.lang.String |
removeQuoteChars(java.lang.String dataStr,
boolean removeDblFlag)
Removes the backslash quote characters ('\') put in by 'insertQuoteChars()'. |
static java.lang.String |
replaceAllSubstrings(java.lang.String dataStr,
java.lang.String oldStr,
java.lang.String newStr)
Replace all of the occurrences of a given substring with a new substring. |
static java.lang.String |
replaceSubstring(java.lang.String dataStr,
java.lang.String oldStr,
java.lang.String newStr)
Replace the first occurrence of a given substring with a new substring. |
static boolean |
setDateFormatPattern(java.text.DateFormat formatObj,
java.lang.String patternStr)
Sets the pattern string for the given 'DateFormat' object. |
static void |
setDateFormatSymbols(java.text.DateFormat formatObj,
java.text.DateFormatSymbols newSymbols)
Sets the date format symbols for the date format object. |
static void |
setDecimalFormatSymbols(java.text.NumberFormat formatObj,
java.text.DecimalFormatSymbols newSymbols)
Sets the decimal format symbols for the number format object. |
static void |
setDefaultLocale(java.util.Locale localeObj)
Sets the default locale. |
static java.net.URL |
setURLReference(java.net.URL urlObj,
java.lang.String refStr)
Creates a new URL containing the given reference (anchor) string. |
static java.lang.String |
shortClassString(java.lang.Class classObj)
Converts the given Class object to "short" String name (with "java.lang." removed). |
static boolean |
sleep(long millisecs)
Delays for the given number of milliseconds. |
static java.lang.String |
softWordWrapString(java.lang.String srcStr,
int lineWidth,
java.lang.String indentStr)
Performs a "soft" word-wrap of the given data. |
static java.lang.String |
softWordWrapString(java.lang.String srcStr,
int lineWidth,
java.lang.String indentStr,
java.lang.String newLineStr)
Performs a "soft" word-wrap of the given data. |
static boolean |
stringToBoolean(java.lang.String s)
Converts the given string to a boolean value. |
static boolean |
stringToBoolean(java.lang.String s,
boolean defaultValue)
Converts the given string to a boolean value. |
static java.lang.Integer |
stringToColorRGB(java.lang.String str)
Converts the given string to the integer RGB representation of the corresponding color. |
static java.lang.Integer |
stringToColorRGB(java.lang.String str,
boolean tryRGBFlag)
Converts the given color name string to the integer RGB representation of the corresponding color. |
static java.lang.String |
stringToFileName(java.lang.String str)
Converts the given string to a string that is safe to use as a file name. |
static java.lang.String |
stripBrackets(java.lang.String str)
Returns a new string created by stripping the bracket characters from around the given string. |
static java.lang.String |
stripChar(java.lang.String str,
char ch)
Removes all occurrences of the given character from the given string. |
static java.lang.String |
stripTrailingNewline(java.lang.String dataStr)
Removes a newline from the end of a "data" string. |
static java.lang.String |
stripTrailingString(java.lang.String dataStr,
java.lang.String stripStr)
Removes a given "strip" string from the end of a "data" string. |
static java.lang.String |
timeMillisToRFC_822String(long millis)
Converts the given integer time value to a RFC-822 date/time string. |
static java.lang.String |
timeMillisToString()
Converts the current time value to a date/time string using the 24-hour clock format and the local time zone. |
static java.lang.String |
timeMillisToString(long millis)
Converts the given integer time value to a date/time string using the 24-hour clock format and the local time zone. |
static java.lang.String |
timeMillisToString(long millis,
boolean gmtFlag)
Converts the given integer time value to a date/time string using the 24-hour clock format. |
static java.lang.String |
timeMillisToString(long millis,
boolean gmtFlag,
boolean amPmFlag)
Converts the given integer time value to a date/time string. |
static java.lang.String |
toHexString(int i,
int numDigits)
Creates a string representation of the integer argument as an unsigned integer in base-16. |
static java.lang.String |
trimEndStr(java.lang.String str)
Trims whitespace at the end of the given string. |
static java.lang.String |
trimMultiLineString(java.lang.String inString)
Trims leading and trailing whitespace from each line inside of the given string (while retaining the line separations). |
static java.lang.String |
trimMultiLineString(java.lang.String inString,
int centerFieldLen)
Trims leading and trailing whitespace from each line inside of the given string (while retaining the line separations). |
static java.lang.String |
trimMultiLineString(java.lang.String inString,
java.lang.String newLineStr)
Trims leading and trailing whitespace from each line inside of the given string (while retaining the line separations). |
static java.lang.String |
trimMultiLineString(java.lang.String inString,
java.lang.String newLineStr,
int centerFieldLen)
Trims leading and trailing whitespace from each line inside of the given string (while retaining the line separations). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String BOOLEAN_TRUE_TEXT
public static final java.lang.String BOOLEAN_FALSE_TEXT
public static final long MS_PER_SECOND
public static final long SECONDS_PER_MINUTE
public static final long MS_PER_MINUTE
public static final long MINUTES_PER_HOUR
public static final long MS_PER_HOUR
public static final long HOURS_PER_DAY
public static final long MINUTES_PER_DAY
public static final long SECONDS_PER_DAY
public static final long MS_PER_DAY
public static final java.lang.String EMPTY_STRING
public static final java.lang.String QUOTE_STRING
public static final java.lang.String DATE_FORMAT24_STR
public static final java.lang.String DATE_FORMAT_AMPM_STR
public static final java.util.TimeZone GMT_TIME_ZONE_OBJ
public static final int colorPropertyStringLength
public static final java.lang.String DATE_FORMAT_RFC_822_STR
public static final CfgPropValidator timeZoneValidator
public static final java.lang.String newline
public static final java.lang.String[] FAKE_IP_ADDRS
public static final java.lang.String DEF_SPECIAL_CHARS_STR
protected static java.lang.String INVALID_FILENAME_CHARS
Method Detail |
public static long getSystemTimeSec()
public static long intTimeToLong(int intTime)
intTime
- a time value in seconds.
public static final java.lang.String dateToRFC_822String(java.util.Date date)
date
- the time value to be formatted into a time string.
public static final java.lang.String timeMillisToRFC_822String(long millis)
millis
- a time in milliseconds since midnight,
January 1, 1970 UTC.
public static java.lang.String timeMillisToString(long millis, boolean gmtFlag, boolean amPmFlag)
millis
- a time in milliseconds since midnight,
January 1, 1970 UTC.gmtFlag
- true for GMT time zone, false for local time zone.amPmFlag
- true for AM/PM clock, false for 24-hour clock.
public static java.lang.String timeMillisToString(long millis, boolean gmtFlag)
millis
- a time in milliseconds since midnight,
January 1, 1970 UTC.gmtFlag
- true for GMT time zone, false for local time zone.
public static java.lang.String timeMillisToString(long millis)
millis
- a time in milliseconds since midnight,
January 1, 1970 UTC.
public static java.lang.String timeMillisToString()
public static java.lang.String durationMillisToString(long durationMs, boolean showDaysFlag, boolean showSecsFlag, boolean verboseFlag)
durationMs
- the number of milliseconds.showDaysFlag
- if true and the number of hours is not less
than 24 then the number of days is displayed; if false then the
total number of hours is always displayed.showSecsFlag
- if true then the number of seconds is included.verboseFlag
- if true then show verbose text.
public static java.lang.String durationMillisToString(long durationMs, boolean showDaysFlag, boolean showSecsFlag)
durationMs
- the number of milliseconds.showDaysFlag
- if true and the number of hours is not less
than 24 then the number of days is displayed; if false then the
total number of hours is always displayed.showSecsFlag
- if true then the number of seconds is included.
public static java.lang.String durationMillisToString(long durationMs, boolean showDaysFlag)
durationMs
- the number of milliseconds.showDaysFlag
- if true and the number of hours is not less
than 24 then the number of days is displayed; if false then the
total number of hours is always displayed.
public static java.lang.String durationMillisToString(long durationMs)
durationMs
- the number of milliseconds.
public static java.util.Date parseStringToDate(java.lang.String dateStr, boolean gmtFlag, boolean amPmFlag)
dateStr
- a date/time string in the form
"MMM dd yyyy hh:mm:ss [a] z".gmtFlag
- true for GMT time zone, false for local time zone.amPmFlag
- true for AM/PM clock, false for 24-hour clock.
public static java.util.Date parseStringToDate(java.lang.String s, boolean gmtFlag)
s
- the time value string.gmtFlag
- true for GMT time zone, false for local time zone.
public static java.util.Date parseStringToDate(java.lang.String s)
s
- the time value string.
public static boolean setDateFormatPattern(java.text.DateFormat formatObj, java.lang.String patternStr)
formatObj
- the 'DateFormat' to be changed.patternStr
- the pattern string to apply.
public static void addDataChangedListener(DataChangedListener listenerObj)
listenerObj
- the 'DataChangedListener' object.public static void removeDataChangedListener(DataChangedListener listenerObj)
listenerObj
- the 'DataChangedListener' object.public static void fireDataChanged(java.lang.Object sourceObj)
sourceObj
- source object for the change.public static java.util.Locale getDefaultLocale()
addDataChangedListener, removeDataChangedListener
public static java.util.Locale getSystemLocale()
public static char getDecimalSeparator()
public static void setDateFormatSymbols(java.text.DateFormat formatObj, java.text.DateFormatSymbols newSymbols)
formatObj
- the date format.newSymbols
- the date format symbols.public static void setDecimalFormatSymbols(java.text.NumberFormat formatObj, java.text.DecimalFormatSymbols newSymbols)
formatObj
- the number format.newSymbols
- the decimal format symbols.public static void setDefaultLocale(java.util.Locale localeObj)
localeObj
- the default locale.addDataChangedListener, removeDataChangedListener
public static java.text.DateFormat createDateFormatObj(java.lang.String patternStr, java.util.TimeZone timeZoneObj)
patternStr
- the pattern string to apply.timeZoneObj
- timezone object to apply, or null or none.
public static java.text.DateFormat createDateFormatObj(java.lang.String patternStr, java.util.TimeZone timeZoneObj, java.util.Locale localeObj)
patternStr
- the pattern string to apply.timeZoneObj
- timezone object to apply, or null or none.localeObj
- the locale object.
public static java.text.DateFormat createDateFormatObj(java.lang.String patternStr)
patternStr
- the pattern string to apply.
public static java.text.DateFormat createDateFormatObj(java.lang.String patternStr, java.util.Locale localeObj)
patternStr
- the pattern string to apply.localeObj
- the locale object.
public static java.text.NumberFormat createFloatNumberFormat()
public static java.text.NumberFormat createFloatNumberFormat(java.util.Locale localeObj)
localeObj
- the locale object.
public static java.text.NumberFormat createFloatNumberFormat(int numDigits)
numDigits
- the minimum and maximum number of fraction digits
to be shown.
public static java.text.NumberFormat createFloatNumberFormat(int numDigits, java.util.Locale localeObj)
numDigits
- the minimum and maximum number of fraction digits
to be shown.localeObj
- the locale object.
public static java.text.NumberFormat createFloatNumberFormat(int minDigits, int maxDigits)
minDigits
- the minimum number of fraction digits to be shown.maxDigits
- the maximum number of fraction digits to be shown.
public static java.text.NumberFormat createFloatNumberFormat(int minDigits, int maxDigits, java.util.Locale localeObj)
minDigits
- the minimum number of fraction digits to be shown.maxDigits
- the maximum number of fraction digits to be shown.localeObj
- the locale object.
public static java.text.NumberFormat createFloatNumberFormat(java.lang.String patternStr)
patternStr
- the pattern string to apply.
public static java.text.NumberFormat createFloatNumberFormat(java.lang.String patternStr, java.util.Locale localeObj)
patternStr
- the pattern string to apply.localeObj
- the locale object.
public static java.lang.String[] getTimeZoneIDs()
public static java.util.TimeZone parseTimeZoneID(java.lang.String id)
id
- time zone ID.
public static boolean sleep(long millisecs)
millisecs
- the number of milliseconds to delay.
public static java.lang.String shortClassString(java.lang.Class classObj)
classObj
- a Class object.
public static java.lang.String stripBrackets(java.lang.String str)
str
- the string to use.
public static java.lang.String stripChar(java.lang.String str, char ch)
str
- the given string.ch
- the character to be removed.
public static java.lang.String stripTrailingString(java.lang.String dataStr, java.lang.String stripStr)
dataStr
- the data string to use.stripStr
- the "strip" string to be removed.
public static java.lang.String stripTrailingNewline(java.lang.String dataStr)
dataStr
- the data string to use.
public static java.lang.Number parseNumber(java.lang.String str)
str
- the string to convert.
public static java.lang.Number parseNumber(java.lang.String str, java.lang.Class valueClass)
str
- the string to convert.valueClass
- the specific number class for the value.
public static java.lang.String getUserConsoleString()
public static int getColorDisplayNameIndex(int value)
value
- the RGB value of the color.
getColorDisplayNames()
public static int getColorDisplayNameValue(int index)
index
- the display name index.
getColorDisplayNames()
public static java.lang.String getColorDisplayName(int value)
value
- the RGB value of the color.
getColorDisplayNames()
public static java.lang.String[] getColorDisplayNames()
public static java.lang.Integer stringToColorRGB(java.lang.String str)
str
- the string to be converted.
public static java.lang.Integer stringToColorRGB(java.lang.String str, boolean tryRGBFlag)
str
- the string to be converted.tryRGBFlag
- if true then and no color name match is found
then the method will attempt to interpret the string as a numeric
RGB value or values.
public static java.lang.String booleanToString(boolean b)
b
- the boolean value.
public static java.lang.Boolean booleanValueOf(boolean b)
b
- the boolean value.
public static java.lang.Boolean booleanValueOf(java.lang.String s)
s
- the string representing the boolean value.
public static boolean stringToBoolean(java.lang.String s)
s
- the string representing the boolean value.
public static boolean stringToBoolean(java.lang.String s, boolean defaultValue)
s
- the string representing the boolean value.defaultValue
- the default value if the string is null.
public static java.lang.String colorRGBToString(int colorRGBVal)
colorRGBVal
- the integer color RGB value to use.
public static java.lang.String toHexString(int i, int numDigits)
i
- an integer.numDigits
- the number of hex digits to pad if necessary.
public static java.lang.String colorToPropertyString(java.awt.Color colorObj)
colorObj
- the color.
public static java.lang.String floatNumberToPropertyString(java.lang.Object value)
value
- the number value.
public static java.lang.String floatNumberToString(double value)
value
- the number value.
public static java.lang.String floatNumberToString(double value, int digits)
value
- the number value.digits
- the maximum number of fraction digits to be shown.
public static java.lang.String floatNumberToString(double value, int digits, int columns, java.lang.Comparable maxValueObj)
value
- the number value.digits
- the maximum number of fraction digits to be shown.columns
- the number of the columns for the string or 0 for no limit.maxValueObj
- the maximum value object or null if not needed.
public static java.lang.Object parseObject(java.lang.Class valueClass, java.lang.String dataStr)
valueClass
- the value class.dataStr
- the data string.
public static java.lang.Object parseObject(java.lang.Object defaultValueObj, java.lang.String dataStr)
defaultValueObj
- the default value object.dataStr
- the data string.
public static Archivable parseArchivable(java.lang.Class valueClass, java.lang.String dataStr)
valueClass
- the 'Archivable' value class.dataStr
- the data string.
public static Archivable parseArchivable(Archivable defaultValueObj, java.lang.String dataStr)
defaultValueObj
- the 'Archivable' default value object.dataStr
- the data string.
public static java.awt.Color parseColor(java.lang.String colorString) throws java.lang.NumberFormatException
colorString
- the property string for the color.
java.lang.NumberFormatException
- if the specified string
cannot be interpreted as a color property string.public static java.lang.String colorRGBToString(int colorRGBVal, boolean useHexFlag)
colorRGBVal
- RGB value of color.useHexFlag
- true if hex string should be used if no match.
public static java.awt.Color createOpaqueColor(java.awt.Color colorObj)
colorObj
- the Color object to use.
public static java.lang.String insertQuoteChars(java.lang.String dataStr, java.lang.String specialChars)
dataStr
- the data source string.specialChars
- a string of "special" characters, each of
which should be quoted in the source string.
public static java.lang.String removeQuoteChars(java.lang.String dataStr, boolean removeDblFlag)
dataStr
- the data source string.removeDblFlag
- true to remove any surrounding pair of
double-quote characters ("") from string; false to leave them alone.
public static java.lang.String removeQuoteChars(java.lang.String dataStr)
dataStr
- the data source string.
public static int findCharPos(java.lang.String str, char ch, int startPos)
str
- the string to search.ch
- the character to search for.startPos
- the position in the string to start searching from.
public static int findCharPos(java.lang.String str, char ch)
str
- the string to search.ch
- the character to search for.
public static int findCharPos(java.lang.String str, java.lang.String searchCharsStr, int startPos)
str
- the string to search.searchCharsStr
- the string of search characters.startPos
- the position in the string to start searching from.
public static int findCharPos(java.lang.String str, java.lang.String searchCharsStr)
str
- the string to search.searchCharsStr
- the string of search characters.
public static int indexOfWhitespace(java.lang.String str, int startPos)
str
- the string to search.startPos
- the position at which to start the search.
public static int indexOfWhitespace(java.lang.String str)
str
- the string to search.
public static java.util.Enumeration iteratorToEnum(java.util.Iterator it)
it
- the iterator.
public static java.util.Iterator enumToIterator(java.util.Enumeration e)
e
- the enumeration.
public static java.lang.String enumToListString(java.util.Enumeration e)
e
- the enumeration of data objects to use.
public static java.lang.String enumToString(java.util.Enumeration e)
e
- the enumeration of data objects to use.
public static java.lang.String enumToQuotedStrings(java.util.Enumeration enumObj, java.lang.String sepStr, boolean quoteCharsFlag)
enumObj
- the given enumeration.sepStr
- the string that separates the substrings.quoteCharsFlag
- if true then special characters, such as
double-quote and control characters, will be "quoted" in the
substrings using the backslash character (\r \n \t \\ \").
public static java.lang.String enumToQuotedStrings(java.util.Enumeration enumObj, char sepChar, boolean quoteCharsFlag)
enumObj
- the given enumeration.sepChar
- the character that separates the substrings.quoteCharsFlag
- if true then special characters, such as
double-quote and control characters, will be "quoted" in the
substrings using the backslash character (\r \n \t \\ \").
public static java.lang.String enumToQuotedStrings(java.util.Enumeration enumObj)
enumObj
- the given enumeration.
public static java.util.Vector quotedStringsToVector(java.lang.String str, char sepChar, boolean strictFlag)
str
- the source string.sepChar
- the character that separates the substrings.strictFlag
- if true then the string format is strictly
interpreted--no extraneous spaces are allowed and every substring
must be surrounded by double-quotes.
public static java.util.Vector quotedStringsToVector(java.lang.String str, char sepChar)
str
- the source string.sepChar
- the character that separates the substrings.
public static java.util.Vector quotedStringsToVector(java.lang.String str)
str
- the source string.
public static java.util.Vector quotedStringsToVector(java.lang.String str, java.lang.String sepCharsStr, boolean strictFlag)
str
- the source string.sepCharsStr
- a string of separator characters that may be
used to separate the substrings, or null for " ,;".strictFlag
- if true then the string format is strictly
interpreted--no extraneous spaces are allowed and every substring
must be surrounded by double-quotes.
public static java.util.Vector listStringToVector(java.lang.String str)
str
- the source string.
public static java.util.Vector listStringToVector(java.lang.String str, char sepChar, boolean trimFlag)
str
- the source string.sepChar
- the character that separates the substrings.trimFlag
- if true then all leading and trailing spaces in
substrings is trimmed.
public static boolean moveListElement(java.util.List listObj, int index, java.lang.Object element)
index
is shifted upward to have an index
one greater than the value it had previously. If the index is out of range the element is moved to the end of the list.
listObj
- the list object.index
- index at which the specified element is to be inserted.element
- element to be inserted.
java.lang.UnsupportedOperationException
- if the add method is not
supported by the list.
java.lang.ClassCastException
- if the class of the specified element
prevents it from being added to the list.
java.lang.IllegalArgumentException
- if some aspect of this element
prevents it from being added to the list.public static java.lang.String getTableContentsString(java.util.Map tableObj, java.lang.String sepStr)
tableObj
- the table/map object to use.sepStr
- separator to put between items.
public static java.lang.String getTableContentsString(java.util.Map tableObj)
tableObj
- the table/map object to use.
public static java.util.Vector removeEmptyStrings(java.util.Vector vec)
vec
- the given Vector.
public static java.lang.String fixStringLen(java.lang.String inString, int outLen, boolean rightJustFlag, boolean truncateFlag)
inString
- the given string.outLen
- the desired length of the output string.rightJustFlag
- true for right-justified (spaces inserted
before the given string data); false for left-justified (spaces
added after the given string data).truncateFlag
- if true and the given string is longer than the
desired length then it is truncated to generate the returned string;
if false then the string data is never truncated.
public static java.lang.String fixStringLen(java.lang.String inString, int outLen, boolean rightJustFlag)
inString
- the given string.outLen
- the desired length of the output string.rightJustFlag
- true for right-justified (spaces inserted
before the given string data); false for left-justified (spaces
added after the given string data).
public static java.lang.String fixStringLen(java.lang.String inString, int outLen)
inString
- the given string.outLen
- the desired length of the output string.
public static java.lang.String getSpacerString(int numSpaces)
numSpaces
- the desired number of space characters.
public static java.lang.String createCenteredString(java.lang.String inString, int fieldLen)
inString
- the given string.fieldLen
- the field length for centering.
public static java.lang.String softWordWrapString(java.lang.String srcStr, int lineWidth, java.lang.String indentStr, java.lang.String newLineStr)
srcStr
- data string to use.lineWidth
- target line-width value.indentStr
- indentation to be put in front of generated lines
(after the first one), or null for none.newLineStr
- string to use for generate line-ends.
public static java.lang.String softWordWrapString(java.lang.String srcStr, int lineWidth, java.lang.String indentStr)
srcStr
- data string to use.lineWidth
- target line-width value.indentStr
- indentation to be put in front of generated lines
(after the first one), or null for none.
public static java.lang.String trimEndStr(java.lang.String str)
str
- string to use.
public static java.lang.String trimMultiLineString(java.lang.String inString, java.lang.String newLineStr, int centerFieldLen)
inString
- the given string.newLineStr
- the newline separator to be used between lines
in the returned string.centerFieldLen
- the field length for centering, or 0
for no centering.
public static java.lang.String trimMultiLineString(java.lang.String inString, java.lang.String newLineStr)
inString
- the given string.newLineStr
- the newline separator to be used between lines
in the returned string.
public static java.lang.String trimMultiLineString(java.lang.String inString, int centerFieldLen)
inString
- the given string.centerFieldLen
- the field length for centering, or 0
for no centering.
public static java.lang.String trimMultiLineString(java.lang.String inString)
inString
- the given string.
public static java.lang.String capFirstLetter(java.lang.String str)
str
- the string to use.
public static java.lang.String getPrettyString(java.lang.String str, boolean allUpperFlag)
str
- the string.allUpperFlag
- true to have all words start with upper-case,
false to have only first word start with upper-case.
public static java.lang.String getPrettyString(java.lang.String str)
str
- the string.
public static java.lang.String charToString(char ch)
ch
- the character to use.
public static java.net.InetAddress getLocalHostAddrObj()
public static java.lang.String getLocalHostIP()
public static java.lang.String getLocalHostIP(java.net.InetAddress addrObj)
addrObj
- the Internet-address object.
getLocalHostAddrObj
public static java.lang.String getLocalHostName()
public static java.lang.String getLocalHostName(java.net.InetAddress addrObj)
addrObj
- the Internet-address object.
getLocalHostAddrObj
public static java.net.URL setURLReference(java.net.URL urlObj, java.lang.String refStr)
urlObj
- the URL object to use.refStr
- the reference (anchor) string to use, or null to
specify no reference.
public static boolean isURLAddress(java.lang.String str)
str
- the string to check.
public static boolean isIPAddress(java.lang.String str)
str
- the string to check.
public static boolean isFakeIPAddress(java.lang.String str)
str
- the string to check.
public static java.lang.String replaceSubstring(java.lang.String dataStr, java.lang.String oldStr, java.lang.String newStr)
dataStr
- the data string to be used.oldStr
- the "old" substring to be replaced.newStr
- the "new" substring to be entered.
public static java.lang.String replaceAllSubstrings(java.lang.String dataStr, java.lang.String oldStr, java.lang.String newStr)
dataStr
- the data string to be used.oldStr
- the "old" substring to be replaced.newStr
- the "new" substring to be entered.
public static java.lang.String normalizeString(java.lang.String str)
str
- the string to be normalized.
public static java.lang.String[] parseSeparatedSubstrings(java.lang.String dataStr, java.lang.String sepStr)
dataStr
- the data string to parse.sepStr
- the separator string (if null or an empty string then
"." is used).
public static int parseLeadingInt(java.lang.String numStr) throws java.lang.NumberFormatException
numStr
- the string to parse.
java.lang.NumberFormatException
- if no valid numeric data is found.public static java.lang.Integer[] parseVersionNumbers(java.lang.String verStr)
verStr
- the version string to be parsed.
public static int compareVersionStrings(java.lang.String ver1Str, java.lang.String ver2Str)
ver1Str
- the first version string.ver2Str
- the second version string.
public static java.lang.String getStackTraceString(java.lang.Throwable throwObj)
throwObj
- the throwable object to use.
public static java.lang.String getMemoryInfoStr()
public static java.lang.ThreadGroup getRootThreadGroupObj()
public static int getTotalThreadCount()
public static void beep()
protected static boolean isValidFileNameChar(char ch)
ch
- the character to check.
protected static void addToFileName(java.lang.StringBuffer fileName, char ch)
fileName
- the file name.ch
- the character to be converted.public static java.lang.String stringToFileName(java.lang.String str)
str
- the string to be converted.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |