Package com.reportmill.base
Class RMUtils
- java.lang.Object
- 
- com.reportmill.base.RMUtils
 
- 
 public class RMUtils extends java.lang.ObjectThis class provides a bunch of utility methods for common problems.
- 
- 
Constructor SummaryConstructors Constructor Description RMUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Objectadd(java.lang.Object obj1, java.lang.Object obj2)Returns the sum of the two given objects (assumed to be strings or numbers).static java.math.BigDecimalbigDecimal(java.lang.Object anObj)Returns the BigDecimal value for a given object (assumed to be a string or number).static booleanboolValue(java.lang.Object anObj)Returns a boolean value for the given object.static booleancheckString(java.lang.String aString, boolean isApplication)Checks a string to see if it's valid.static java.lang.Objectclone(java.lang.Object anObj)Returns a clone of the given object (supports List, Map, RMObject, null and others by reflection).static java.lang.ObjectcloneDeep(java.lang.Object anObj)Clones the given object, recursively, if the object is a collection.static booleancopyFile(java.io.File in, java.io.File out)Copies a file from one location to another.static doubledoubleValue(java.lang.Object anObj)Returns the double value for a given object (assumed to be a string or number).static booleanequals(java.lang.Object obj1, java.lang.Object obj2)Returns whether two objects are equal (supports either being null).static floatfloatValue(java.lang.Object anObj)Returns the float value for a given object (assumed to be a string or number).static java.lang.StringgetBuildInfo()Returns a build date string (eg, "Jan-26-03") as generated into BuildInfo.txt at build time.static byte[]getBytes(java.lang.Object aSource)Returns a byte array from a File, String path, InputStream, URL, byte[], etc.static java.lang.ClassgetClassForName(java.lang.String aName)Returns a class for a given name.static java.lang.StringgetClassNameShort(java.lang.Object anObj)Returns the class name for the given object (minus the package name).static java.io.FilegetFile(java.lang.Object aSource)Returns a File object from a File or String path.static java.lang.StringgetHostname()Returns the hostname for this machine.static java.io.InputStreamgetInputStream(java.lang.Object aSource)Returns an input stream from a File, String path, URL, byte array, InputStream, etc.static java.lang.StringgetJarPath()Returns the file path for ReportMill.jar.static intgetProcessorCount()Returns the number of processors on this machine.static java.lang.StringgetTempDir()Returns the temp directory for this machine.static floatgetVersion()Returns the version number of the app.static intintValue(java.lang.Object anObj)Returns the int value for a given object (assumed to be a string or number).static java.lang.ObjectnewInstance(java.lang.Class aClass)Returns a new instance of a given class.static java.lang.Numbernumber(java.lang.Object anObj)Returns the Number for a given object (assumed to be Number or String).static voidopenFile(java.lang.String aName)Opens a named file on the user's desktop.static voidopenURL(java.lang.String aName)Opens a named URL on the user's desktop.static voidsetHeadless()Sets this JVM to be headless.static voidwriteBytes(byte[] bytes, int anOffset, int aLength, java.lang.String aPath)Writes the given bytes (within the specified range) to the given path string.static voidwriteBytes(byte[] bytes, java.lang.String aPath)Writes the given bytes to the given path string.
 
- 
- 
- 
Method Detail- 
getClassNameShortpublic static java.lang.String getClassNameShort(java.lang.Object anObj) Returns the class name for the given object (minus the package name).
 - 
boolValuepublic static boolean boolValue(java.lang.Object anObj) Returns a boolean value for the given object.
 - 
intValuepublic static int intValue(java.lang.Object anObj) Returns the int value for a given object (assumed to be a string or number).
 - 
floatValuepublic static float floatValue(java.lang.Object anObj) Returns the float value for a given object (assumed to be a string or number).
 - 
doubleValuepublic static double doubleValue(java.lang.Object anObj) Returns the double value for a given object (assumed to be a string or number).
 - 
numberpublic static java.lang.Number number(java.lang.Object anObj) Returns the Number for a given object (assumed to be Number or String).
 - 
bigDecimalpublic static java.math.BigDecimal bigDecimal(java.lang.Object anObj) Returns the BigDecimal value for a given object (assumed to be a string or number).
 - 
addpublic static java.lang.Object add(java.lang.Object obj1, java.lang.Object obj2)Returns the sum of the two given objects (assumed to be strings or numbers).
 - 
clonepublic static java.lang.Object clone(java.lang.Object anObj) Returns a clone of the given object (supports List, Map, RMObject, null and others by reflection).
 - 
cloneDeeppublic static java.lang.Object cloneDeep(java.lang.Object anObj) Clones the given object, recursively, if the object is a collection.
 - 
equalspublic static boolean equals(java.lang.Object obj1, java.lang.Object obj2)Returns whether two objects are equal (supports either being null).
 - 
getTempDirpublic static java.lang.String getTempDir() Returns the temp directory for this machine.
 - 
writeBytespublic static void writeBytes(byte[] bytes, java.lang.String aPath)Writes the given bytes to the given path string.
 - 
writeBytespublic static void writeBytes(byte[] bytes, int anOffset, int aLength, java.lang.String aPath)Writes the given bytes (within the specified range) to the given path string.
 - 
getFilepublic static java.io.File getFile(java.lang.Object aSource) Returns a File object from a File or String path.
 - 
getInputStreampublic static java.io.InputStream getInputStream(java.lang.Object aSource) Returns an input stream from a File, String path, URL, byte array, InputStream, etc.
 - 
getBytespublic static byte[] getBytes(java.lang.Object aSource) Returns a byte array from a File, String path, InputStream, URL, byte[], etc.
 - 
openFilepublic static void openFile(java.lang.String aName) Opens a named file on the user's desktop.
 - 
openURLpublic static void openURL(java.lang.String aName) Opens a named URL on the user's desktop.
 - 
checkStringpublic static boolean checkString(java.lang.String aString, boolean isApplication)Checks a string to see if it's valid.
 - 
getHostnamepublic static java.lang.String getHostname() Returns the hostname for this machine.
 - 
getJarPathpublic static java.lang.String getJarPath() Returns the file path for ReportMill.jar.
 - 
getBuildInfopublic static java.lang.String getBuildInfo() Returns a build date string (eg, "Jan-26-03") as generated into BuildInfo.txt at build time.
 - 
getVersionpublic static float getVersion() Returns the version number of the app.
 - 
getProcessorCountpublic static int getProcessorCount() Returns the number of processors on this machine.
 - 
getClassForNamepublic static java.lang.Class getClassForName(java.lang.String aName) Returns a class for a given name.
 - 
newInstancepublic static java.lang.Object newInstance(java.lang.Class aClass) Returns a new instance of a given class.
 - 
setHeadlesspublic static void setHeadless() Sets this JVM to be headless.
 - 
copyFilepublic static boolean copyFile(java.io.File in, java.io.File out)Copies a file from one location to another.
 
- 
 
-