|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.droplets.util.Utilities
Assorted static utility functions used by the Droplet Java API.
Constructor Summary | |
Utilities()
Deprecated. |
Method Summary | |
static boolean |
arraysHaveSameObjects(java.lang.Object[] a1,
java.lang.Object[] a2)
Deprecated. Determines whether the two supplied arrays have exactly the same objects in them, in the same order. |
static java.util.Vector |
arrayToVector(java.lang.Object[] os)
Deprecated. Converts an array to a vector. |
static void |
checkForIllegalChar(java.lang.String s,
char illegalChar)
Deprecated. Throws an exception if the string contains the character specified by illegalChar . |
static java.lang.String |
joinItems(java.lang.String[] items,
char delimiter)
Deprecated. Joins an array of strings into one using the delimiter character (comma). |
static java.lang.String |
joinItems(java.lang.String[] items,
char delimiter,
int startIndex)
Deprecated. Joins an array of strings into one using the delimiter character (comma). |
static java.lang.String[] |
merge(java.lang.String first,
java.lang.String[] rest)
Deprecated. Prepends a string to a string array. |
static int |
stringToInt(java.lang.String s)
Deprecated. Convenience method to convert a String to an int or return 0 if the
conversion fails. |
static java.util.Properties |
stringToProperties(java.lang.String string)
Deprecated. Converts a String to a Properties object. |
static java.lang.String |
subString(java.lang.String s,
int begin,
int end)
Deprecated. Same as string.subString . |
static java.lang.String[] |
tokenize(java.lang.String input,
char delimiter)
Deprecated. Split string into tokens using the delimiter. |
static java.lang.String[] |
vectorToStringArray(java.util.Vector v)
Deprecated. Converts Vector of Object to array of
String . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Utilities()
Method Detail |
public static boolean arraysHaveSameObjects(java.lang.Object[] a1, java.lang.Object[] a2)
Object.equals
to compare object values.a1
- the first arraya2
- the second arraypublic static java.util.Vector arrayToVector(java.lang.Object[] os)
os
- an arraypublic static void checkForIllegalChar(java.lang.String s, char illegalChar)
illegalChar
.s
- the stringillegalChar
- the illegal characterjava.lang.IllegalArgumentException
- if there are any illegal chars in
the stringpublic static java.lang.String joinItems(java.lang.String[] items, char delimiter)
items
- array of the strings to joindelimiter
- a character to put between each element of the arrayjava.lang.IllegalArgumentException
- if any of the items to be joined
contains the delimiterpublic static java.lang.String joinItems(java.lang.String[] items, char delimiter, int startIndex)
items
- array of the strings to joindelimiter
- a character to put between each element of the arraystartindex
- index of the array to start withjava.lang.IllegalArgumentException
- if any of the items to be joined
contains the delimiterpublic static java.lang.String[] merge(java.lang.String first, java.lang.String[] rest)
first
- a stringrest
- a string arrayfirst
parameter and whose rest is the strings in the rest
parameterpublic static int stringToInt(java.lang.String s)
String
to an int
or return 0 if the
conversion fails. Saves client code from having to handle
NumberFormatExceptions
all over the place.s
- a stringpublic static java.util.Properties stringToProperties(java.lang.String string)
string
- the String to convert. If null, an empty Properties
object will be returned.java.lang.IllegalArgumentException
- if the String cannot be parsed as
a valid .properties
filepublic static java.lang.String subString(java.lang.String s, int begin, int end)
string.subString
. Work around for some bug in Java 1.0. Will replace this to use
String.subString
once this stops being an issue.s
- String to look at.begin
- Starting index of the substring.end
- Ending index (inclusive) of the substring.public static java.lang.String[] tokenize(java.lang.String input, char delimiter)
input
- String to split.delimiter
- Delimiter to use.public static java.lang.String[] vectorToStringArray(java.util.Vector v)
Vector
of Object
to array of
String
. Null references within the vector are converted to
"".v
- Vector
to be convertedtoString()
on the items in the Vector
NullPointerException
- if the argument is null
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |