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 SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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- 
isWindowspublic static boolean isWindows
- 
isMacpublic static boolean isMac
- 
isApppublic static boolean isApp
- 
isAppletpublic static boolean isApplet
- 
isOneWinpublic static boolean isOneWin
- 
isJava5public static boolean isJava5
 
- 
- 
Constructor Details- 
RMUtilspublic RMUtils()
 
- 
- 
Method Details- 
getClassNameShortReturns the class name for the given object (minus the package name).
- 
boolValueReturns a boolean value for the given object.
- 
intValueReturns the int value for a given object (assumed to be a string or number).
- 
floatValueReturns the float value for a given object (assumed to be a string or number).
- 
doubleValueReturns the double value for a given object (assumed to be a string or number).
- 
numberReturns the Number for a given object (assumed to be Number or String).
- 
bigDecimalReturns the BigDecimal value for a given object (assumed to be a string or number).
- 
addReturns the sum of the two given objects (assumed to be strings or numbers).
- 
cloneReturns a clone of the given object (supports List, Map, RMObject, null and others by reflection).
- 
cloneDeepClones the given object, recursively, if the object is a collection.
- 
equalsReturns whether two objects are equal (supports either being null).
- 
getTempDirReturns the temp directory for this machine.
- 
writeBytesWrites the given bytes to the given path string.
- 
writeBytesWrites the given bytes (within the specified range) to the given path string.
- 
getFileReturns a File object from a File or String path.
- 
getInputStreamReturns an input stream from a File, String path, URL, byte array, InputStream, etc.
- 
getBytesReturns a byte array from a File, String path, InputStream, URL, byte[], etc.
- 
openFileOpens a named file on the user's desktop.
- 
openURLOpens a named URL on the user's desktop.
- 
checkStringChecks a string to see if it's valid.
- 
getHostnameReturns the hostname for this machine.
- 
getJarPathReturns the file path for ReportMill.jar.
- 
getBuildInfoReturns 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.
- 
getClassForNameReturns a class for a given name.
- 
newInstanceReturns a new instance of a given class.
- 
setHeadlesspublic static void setHeadless()Sets this JVM to be headless.
- 
copyFileCopies a file from one location to another.
 
-