Package com.reportmill.base
Class RMUtils
java.lang.Object
com.reportmill.base.RMUtils
This class provides a bunch of utility methods for common problems.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectReturns the sum of the two given objects (assumed to be strings or numbers).static BigDecimalbigDecimal(Object anObj) Returns the BigDecimal value for a given object (assumed to be a string or number).static booleanReturns a boolean value for the given object.static booleancheckString(String aString, boolean isApplication) Checks a string to see if it's valid.static ObjectReturns a clone of the given object (supports List, Map, RMObject, null and others by reflection).static ObjectClones the given object, recursively, if the object is a collection.static booleanCopies a file from one location to another.static doubledoubleValue(Object anObj) Returns the double value for a given object (assumed to be a string or number).static booleanReturns whether two objects are equal (supports either being null).static floatfloatValue(Object anObj) Returns the float value for a given object (assumed to be a string or number).static StringReturns a build date string (eg, "Jan-26-03") as generated into BuildInfo.txt at build time.static byte[]Returns a byte array from a File, String path, InputStream, URL, byte[], etc.static ClassgetClassForName(String aName) Returns a class for a given name.static StringgetClassNameShort(Object anObj) Returns the class name for the given object (minus the package name).static FileReturns a File object from a File or String path.static StringReturns the hostname for this machine.static InputStreamgetInputStream(Object aSource) Returns an input stream from a File, String path, URL, byte array, InputStream, etc.static StringReturns the file path for ReportMill.jar.static intReturns the number of processors on this machine.static StringReturns the temp directory for this machine.static floatReturns the version number of the app.static intReturns the int value for a given object (assumed to be a string or number).static ObjectnewInstance(Class aClass) Returns a new instance of a given class.static NumberReturns the Number for a given object (assumed to be Number or String).static voidOpens a named file on the user's desktop.static voidOpens a named URL on the user's desktop.static voidSets this JVM to be headless.static voidwriteBytes(byte[] bytes, int anOffset, int aLength, String aPath) Writes the given bytes (within the specified range) to the given path string.static voidwriteBytes(byte[] bytes, String aPath) Writes the given bytes to the given path string.
-
Field Details
-
isWindows
public static boolean isWindows -
isMac
public static boolean isMac -
isApp
public static boolean isApp -
isApplet
public static boolean isApplet -
isOneWin
public static boolean isOneWin -
isJava5
public static boolean isJava5
-
-
Constructor Details
-
RMUtils
public RMUtils()
-
-
Method Details
-
getClassNameShort
Returns the class name for the given object (minus the package name). -
boolValue
Returns a boolean value for the given object. -
intValue
Returns the int value for a given object (assumed to be a string or number). -
floatValue
Returns the float value for a given object (assumed to be a string or number). -
doubleValue
Returns the double value for a given object (assumed to be a string or number). -
number
Returns the Number for a given object (assumed to be Number or String). -
bigDecimal
Returns the BigDecimal value for a given object (assumed to be a string or number). -
add
Returns the sum of the two given objects (assumed to be strings or numbers). -
clone
Returns a clone of the given object (supports List, Map, RMObject, null and others by reflection). -
cloneDeep
Clones the given object, recursively, if the object is a collection. -
equals
Returns whether two objects are equal (supports either being null). -
getTempDir
Returns the temp directory for this machine. -
writeBytes
Writes the given bytes to the given path string. -
writeBytes
Writes the given bytes (within the specified range) to the given path string. -
getFile
Returns a File object from a File or String path. -
getInputStream
Returns an input stream from a File, String path, URL, byte array, InputStream, etc. -
getBytes
Returns a byte array from a File, String path, InputStream, URL, byte[], etc. -
openFile
Opens a named file on the user's desktop. -
openURL
Opens a named URL on the user's desktop. -
checkString
Checks a string to see if it's valid. -
getHostname
Returns the hostname for this machine. -
getJarPath
Returns the file path for ReportMill.jar. -
getBuildInfo
Returns a build date string (eg, "Jan-26-03") as generated into BuildInfo.txt at build time. -
getVersion
public static float getVersion()Returns the version number of the app. -
getProcessorCount
public static int getProcessorCount()Returns the number of processors on this machine. -
getClassForName
Returns a class for a given name. -
newInstance
Returns a new instance of a given class. -
setHeadless
public static void setHeadless()Sets this JVM to be headless. -
copyFile
Copies a file from one location to another.
-