com.droplets.util
Class Utilities

java.lang.Object
  |
  +--com.droplets.util.Utilities

Deprecated. The functions contained here are available in the Java SDK.

Assorted static utility functions used by the Droplet Java API.

public class Utilities
extends java.lang.Object


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

Utilities

public Utilities()
Deprecated. 
Method Detail

arraysHaveSameObjects

public 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. Uses == to compare reference values, not Object.equals to compare object values.
Parameters:
a1 - the first array
a2 - the second array

arrayToVector

public static java.util.Vector arrayToVector(java.lang.Object[] os)
Deprecated. 
Converts an array to a vector.
Parameters:
os - an array
Returns:
a vector with the same objects in the same order, or an empty vector if null was passed in.

checkForIllegalChar

public static void checkForIllegalChar(java.lang.String s,
                                       char illegalChar)
Deprecated. 
Throws an exception if the string contains the character specified by illegalChar.
Parameters:
s - the string
illegalChar - the illegal character
Throws:
java.lang.IllegalArgumentException - if there are any illegal chars in the string

joinItems

public static java.lang.String joinItems(java.lang.String[] items,
                                         char delimiter)
Deprecated. 
Joins an array of strings into one using the delimiter character (comma). If you pass in a null or an empty array, returns the empty string. Items in the array that are null are treated as if they were the empty string.
Parameters:
items - array of the strings to join
delimiter - a character to put between each element of the array
Returns:
all items concatenated together, separated by the delimiter
Throws:
java.lang.IllegalArgumentException - if any of the items to be joined contains the delimiter

joinItems

public 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). If you pass in a null or an empty array, returns the empty string. Items in the array that are null are treated as if they were the empty string.
Parameters:
items - array of the strings to join
delimiter - a character to put between each element of the array
startindex - index of the array to start with
Returns:
all items (starting at startIndex) concatenated together, separated by the delimiter
Throws:
java.lang.IllegalArgumentException - if any of the items to be joined contains the delimiter

merge

public static java.lang.String[] merge(java.lang.String first,
                                       java.lang.String[] rest)
Deprecated. 
Prepends a string to a string array.
Parameters:
first - a string
rest - a string array
Returns:
a new string array whose first element is the first parameter and whose rest is the strings in the rest parameter

stringToInt

public static int stringToInt(java.lang.String s)
Deprecated. 
Convenience method to convert a String to an int or return 0 if the conversion fails. Saves client code from having to handle NumberFormatExceptions all over the place.
Parameters:
s - a string
Returns:
the integer value of the string, or 0 if the string cannot be parsed as an integer

stringToProperties

public static java.util.Properties stringToProperties(java.lang.String string)
Deprecated. 
Converts a String to a Properties object.
Parameters:
string - the String to convert. If null, an empty Properties object will be returned.
Returns:
a new Properties object
Throws:
java.lang.IllegalArgumentException - if the String cannot be parsed as a valid .properties file

subString

public static java.lang.String subString(java.lang.String s,
                                         int begin,
                                         int end)
Deprecated. 
Same as string.subString. Work around for some bug in Java 1.0. Will replace this to use String.subString once this stops being an issue.
Parameters:
s - String to look at.
begin - Starting index of the substring.
end - Ending index (inclusive) of the substring.

tokenize

public static java.lang.String[] tokenize(java.lang.String input,
                                          char delimiter)
Deprecated. 
Split string into tokens using the delimiter.
Parameters:
input - String to split.
delimiter - Delimiter to use.

vectorToStringArray

public static java.lang.String[] vectorToStringArray(java.util.Vector v)
Deprecated. 
Converts Vector of Object to array of String. Null references within the vector are converted to "".
Parameters:
v - Vector to be converted
Returns:
an array of Strings representing the result of calling toString() on the items in the Vector
Throws:
NullPointerException - if the argument is null


Copyright © Droplets, 2001. All Rights Reserved.