public class RibsUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RibsUtils.RBException
This Error subclass lets us rethrow exceptions.
|
Modifier and Type | Field and Description |
---|---|
static boolean |
isMac |
static boolean |
isWindows |
Constructor and Description |
---|
RibsUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
copyFile(java.io.File in,
java.io.File out)
Copies a file from one location to another.
|
static boolean |
equals(java.lang.Object obj1,
java.lang.Object obj2)
Returns whether two objects are equal (either can be null).
|
static byte[] |
getBytes(java.lang.Object aSource)
Returns the bytes derived from reading source (supports File, String path, URL, InputStream, byte[] and more).
|
static java.lang.Class |
getClassForName(java.lang.String aName)
Returns a class for a given name.
|
static java.lang.String |
getClassNameShort(java.lang.Object anObj)
Returns just the class name string (w/o package name).
|
static java.io.File |
getFile(java.lang.Object aSource)
Returns the File derived from reading source (supports File, String path).
|
static java.io.InputStream |
getInputStream(java.lang.Object aSource)
Returns the input stream dervied from reading source (supports File, String path, InputStream and more).
|
static java.lang.reflect.Method |
getMethod(java.lang.Object anObj,
java.lang.String aMethod,
java.lang.Class parameterType)
Returns the method for the given object, method name and parameter type class.
|
static java.lang.reflect.Method |
getMethod(java.lang.Object anObj,
java.lang.String aMethod,
java.lang.Class[] parameterTypes)
Returns the method for the given object, method name and paramter types class array.
|
static java.lang.Object |
invoke(java.lang.Object anObj,
java.lang.reflect.Method aMethod,
java.lang.Object aValue)
Calls the given method on the given object with the given parameter.
|
static java.lang.Object |
invoke(java.lang.Object anObj,
java.lang.reflect.Method aMethod,
java.lang.Object[] parameters)
Calls the given method name on the given object with the given arg array and class array.
|
static java.lang.Object |
invoke(java.lang.Object anObj,
java.lang.String aMethod)
Calls the given method name on the given object.
|
static java.lang.Object |
invoke(java.lang.Object anObj,
java.lang.String aMethod,
java.lang.Object[] parameters,
java.lang.Class[] parameterTypes)
Calls the given method name on the given object with the given arg array and class array.
|
static java.lang.Object |
invoke(java.lang.Object anObj,
java.lang.String aMethod,
java.lang.Object aValue,
java.lang.Class parameterType)
Calls the given method name on the given object with the given parameter of the given class.
|
static java.lang.Object |
newInstance(java.lang.Class aClass,
boolean complain)
Returns a new instance.
|
static java.util.prefs.Preferences |
prefs()
Returns the user Preferences object.
|
static void |
prefsPut(java.lang.String aKey,
java.lang.Object anObj)
Adds an object to the user Preferences object.
|
static void |
setPrefsClass(java.lang.Class aClass)
Sets the class that ribs preferences are associated with.
|
static java.lang.String |
writeBytes(byte[] bytes,
int anOffset,
int aLength,
java.lang.String aPath,
boolean safely)
Writes the given byte array to given path.
|
static java.lang.String |
writeBytes(byte[] bytes,
java.lang.String aPath,
boolean safely)
Writes the given byte array to given path.
|
public static boolean equals(java.lang.Object obj1, java.lang.Object obj2)
public static java.lang.String getClassNameShort(java.lang.Object anObj)
public static java.lang.Class getClassForName(java.lang.String aName)
public static java.lang.Object newInstance(java.lang.Class aClass, boolean complain)
public static java.util.prefs.Preferences prefs()
public static void prefsPut(java.lang.String aKey, java.lang.Object anObj)
public static void setPrefsClass(java.lang.Class aClass)
public static byte[] getBytes(java.lang.Object aSource)
public static java.io.InputStream getInputStream(java.lang.Object aSource)
public static java.io.File getFile(java.lang.Object aSource)
public static boolean copyFile(java.io.File in, java.io.File out)
public static java.lang.String writeBytes(byte[] bytes, java.lang.String aPath, boolean safely)
public static java.lang.String writeBytes(byte[] bytes, int anOffset, int aLength, java.lang.String aPath, boolean safely)
public static java.lang.reflect.Method getMethod(java.lang.Object anObj, java.lang.String aMethod, java.lang.Class parameterType)
public static java.lang.reflect.Method getMethod(java.lang.Object anObj, java.lang.String aMethod, java.lang.Class[] parameterTypes)
public static java.lang.Object invoke(java.lang.Object anObj, java.lang.String aMethod)
public static java.lang.Object invoke(java.lang.Object anObj, java.lang.String aMethod, java.lang.Object aValue, java.lang.Class parameterType)
public static java.lang.Object invoke(java.lang.Object anObj, java.lang.String aMethod, java.lang.Object[] parameters, java.lang.Class[] parameterTypes)
public static java.lang.Object invoke(java.lang.Object anObj, java.lang.reflect.Method aMethod, java.lang.Object aValue)
public static java.lang.Object invoke(java.lang.Object anObj, java.lang.reflect.Method aMethod, java.lang.Object[] parameters)