|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.deduced.utilities.ObjectUtilities
public class ObjectUtilities

ObjectUtilities is used to host static utility methods to deal with java objects
| Field Summary | |
|---|---|
private static int |
DEFAULT_READ_ARRAY_SIZE
default read array size when reading an input stream |
| Constructor Summary | |
|---|---|
ObjectUtilities()
|
|
| Method Summary | ||
|---|---|---|
static java.lang.String |
aggregateStringListWithSeparator(java.util.List<java.lang.String> stringListToAggregate,
java.lang.String separator)
aggregate String list. |
|
static
|
callCloneOnObject(E valueToClone)
Call the clone method on an object if it exists. |
|
static void |
clearRemainingArraySpace(int clearStartIndex,
java.lang.Object[] arrayToClear)
Reset all array slots to null starting with clearStartIndex until the end of the array |
|
static
|
copyArrayToArray(T[] arrayToModify,
java.lang.Object[] sourceArray,
int size)
Utility method used to convert a source array to a destination array. |
|
static
|
enlargeArrayIfTooSmall(int size,
T[] sourceArray)
Enlarge an array if it is too small. |
|
static byte[] |
inputStreamToByteArray(java.io.InputStream stream,
int initialSize)
convert an input stream to a byte array |
|
static java.lang.String |
inputStreamToString(java.io.InputStream stream)
convert an input stream to a string |
|
static void |
sleepSilent(long milliseconds)
sleep Silent ignores interrupted exceptions |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int DEFAULT_READ_ARRAY_SIZE
| Constructor Detail |
|---|
public ObjectUtilities()
| Method Detail |
|---|
public static <E> E callCloneOnObject(E valueToClone)
E - the type of object to clonevalueToClone - the value to clone
public static java.lang.String inputStreamToString(java.io.InputStream stream)
throws java.io.IOException
stream - the stream to convert
java.io.IOException - if reading fails
public static byte[] inputStreamToByteArray(java.io.InputStream stream,
int initialSize)
throws java.io.IOException
stream - the stream to convertinitialSize - the initial buffer size
java.io.IOException - if reading fails
public static <T> T[] enlargeArrayIfTooSmall(int size,
T[] sourceArray)
T - the type of objects contained in the arraysize - the size the array must containsourceArray - the source array that might be reused if it is large
enough
public static <T> T[] copyArrayToArray(T[] arrayToModify,
java.lang.Object[] sourceArray,
int size)
T - the object type in the array to modify and returnarrayToModify - the array that might be modified if the array is big
enoughsourceArray - the array that will be read and used to fill the
returned arraysize - size of the source array to copy.
public static void clearRemainingArraySpace(int clearStartIndex,
java.lang.Object[] arrayToClear)
clearStartIndex - the start index that will be used to clear the
arrayarrayToClear - the array to start clearingpublic static void sleepSilent(long milliseconds)
milliseconds - the amount of time to sleep for in milliseconds.
public static java.lang.String aggregateStringListWithSeparator(java.util.List<java.lang.String> stringListToAggregate,
java.lang.String separator)
Examples :
arrayToAggregate = {"a","b","c"}, separator = "," will result in : "a,b,c"
arrayToAggregate = {"a"}, separator = "," will result in : "a"
arrayToAggregate = {"a","b","c"}, separator = null will result in : "abc"
stringListToAggregate - the list of string to aggregateseparator - the separator to use between each string. If this is
null, no separator will be inserted between each string.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||