|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ikokoon.toolkit.Toolkit
public class Toolkit
This class contains methods for changing a string to the byte code representation and visa versa. Also some other nifty functions like stripping a string of white space etc.
| Nested Class Summary | |
|---|---|
static interface |
Toolkit.IFileFilter
This is the interface to select files with below. |
| Constructor Summary | |
|---|---|
Toolkit()
|
|
| Method Summary | ||
|---|---|---|
static java.lang.String |
classNameToPackageName(java.lang.String className)
Takes the name of a class and returns the package name for the class. |
|
static void |
copyFile(java.io.File src,
java.io.File dest)
This function will copy files or directories from one location to another. note that the source and the destination must be mutually exclusive. |
|
static void |
deleteFile(java.io.File file,
int maxRetryCount,
int retryCount)
Deletes all the files recursively and then the directories recursively. |
|
static void |
deleteFiles(java.io.File file,
java.lang.String... extensions)
Deletes all the files in a directory with one of the specified extensions. |
|
static java.lang.Object |
deserializeFromBase64(java.lang.String base64)
De-serializes an object from a base 64 string to an object. |
|
static java.lang.String |
dotToSlash(java.lang.String name)
This method replaces the . in the byte code name with / which is what we expect from byte code. |
|
static void |
findFiles(java.io.File file,
Toolkit.IFileFilter filter,
java.util.List<java.io.File> list)
Finds files on the file system below the directory specified recursively using the selection criteria supplied in the IFileFilter parameter. |
|
static double |
format(double d,
int precision)
Formats a double to the required precision. |
|
static java.lang.String |
format(java.lang.String string,
int precision)
Formats a string to the desired precision. |
|
static java.io.ByteArrayOutputStream |
getContents(java.io.File file)
Reads the contents of the file and returns the contents in a byte array form. |
|
static java.io.ByteArrayOutputStream |
getContents(java.io.InputStream inputStream)
Reads the contents of the file and returns the contents in a byte array form. |
|
static java.lang.reflect.Field |
getField(java.lang.Class<?> klass,
java.lang.String name)
Gets a field in the class or in the heirachy of the class. |
|
static
|
getUniqueValues(T t)
Returns an array of values that are defined as being a unique combination for the entity by using the Unique annotation for the class. |
|
static
|
getValue(java.lang.Class<E> klass,
java.lang.Object object,
java.lang.String name)
Returns the value of the field specified from the object specified. |
|
static java.lang.Long |
hash(java.lang.Object... objects)
Builds a hash from an array of objects. |
|
static java.lang.Long |
hash(java.lang.String string)
Simple, fast hash function to generate quite unique hashes from strings(i.e. toCharArray()). |
|
static java.lang.String |
replaceAll(java.lang.String aInput,
java.lang.String aOldPattern,
java.lang.String aNewPattern)
If Java 1.4 is unavailable, the following technique may be used. |
|
static java.lang.String |
serializeToBase64(java.lang.Object object)
Serializes an object to a byte array then to a base 64 string of the byte array. |
|
static void |
setContents(java.io.File file,
byte[] bytes)
Writes the contents of a byte array to a file. |
|
static java.lang.String |
slashToDot(java.lang.String name)
This method replaces the / in the byte code name with . which is XML friendly. |
|
static java.lang.String |
stripWhitespace(java.lang.String string)
Removes any whitespace from the string. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Toolkit()
| Method Detail |
|---|
public static final java.lang.Long hash(java.lang.String string)
string - the string to generate the hash from
public static final java.lang.Long hash(java.lang.Object... objects)
objects - the objects to build the hash from
public static java.lang.String slashToDot(java.lang.String name)
name - the byte code name of a class
public static java.lang.String dotToSlash(java.lang.String name)
name - the name of the class or package
public static java.lang.String classNameToPackageName(java.lang.String className)
className - the name of the class fully qualified
public static java.lang.String stripWhitespace(java.lang.String string)
string - the string to remove whitespace from
public static java.lang.reflect.Field getField(java.lang.Class<?> klass,
java.lang.String name)
klass - the original classname - the name of the field
public static <E> E getValue(java.lang.Class<E> klass,
java.lang.Object object,
java.lang.String name)
object - the object to get the field value fromname - the name of the field in the object
public static void deleteFile(java.io.File file,
int maxRetryCount,
int retryCount)
file - the directory or file to delete
public static void deleteFiles(java.io.File file,
java.lang.String... extensions)
file - the file to delete or the directory to delete files inextensions - the extensions of files to delete
public static void findFiles(java.io.File file,
Toolkit.IFileFilter filter,
java.util.List<java.io.File> list)
file - the file to start looking fromfilter - the filter to select files withlist - the list of files to add the selected files topublic static java.io.ByteArrayOutputStream getContents(java.io.File file)
file - the file to read the contents from
java.lang.Exceptionpublic static java.io.ByteArrayOutputStream getContents(java.io.InputStream inputStream)
inputStream - the file to read the contents from
java.lang.Exception
public static void setContents(java.io.File file,
byte[] bytes)
file - the file to write tobytes - the byte data to write
public static double format(double d,
int precision)
d - the double to formatprecision - the precision for the result
public static java.lang.String format(java.lang.String string,
int precision)
string - the string to format to a precisionprecision - the precision of the result
public static java.lang.String serializeToBase64(java.lang.Object object)
object - the object to serialise to base 64
public static java.lang.Object deserializeFromBase64(java.lang.String base64)
base64 - the base 64 string representation of the object
public static <T> T[] getUniqueValues(T t)
T - the type of object to be inspected for unique fieldst - the object t inspect for unique field combinations
public static void copyFile(java.io.File src,
java.io.File dest)
src - A File object that represents the source for the copydest - A File object that represents the destination for the copy.
public static java.lang.String replaceAll(java.lang.String aInput,
java.lang.String aOldPattern,
java.lang.String aNewPattern)
aInput - is the original String which may contain substring aOldPatternaOldPattern - is the non-empty substring which is to be replacedaNewPattern - is the replacement for aOldPattern
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||