Package com.inductiveautomation.rm.base
Class RMUtils
java.lang.Object
com.inductiveautomation.rm.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 BooleanbooleanValue(Object anObj) Returns the Boolean for a given object (assumed to be Number or String).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 <T> Tclone(T anObj) Returns a clone of the given object (supports List, Map, RMObject, null and others by reflection).static <T> TcloneDeep(T anObj) Clones the given object, recursively, if the object is a collection.static intReturns result of comparing two values.static booleanReturns whether to do something once based on given unique id string.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 BigDecimalgetBigDecimal(Object anObj) Returns the BigDecimal 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[]getBytes(InputStream aStream) Returns bytes for an input stream.static byte[]Returns a byte array from a File, String path, InputStream, URL, byte[], etc.static byte[]getBytes2(InputStream aStream) Returns bytes for an input stream.static DateReturns a date for given object of arbitrary type.static DoubleReturns a Double for a given object.static FloatReturns a Float for a given object.static StringReturns the hostname for this machine.static intReturns a unique id for a string each time it's called, starting with 0.static InputStreamgetInputStream(Object aSource) Returns an input stream from a File, String path, URL, byte array, InputStream, etc.static IntegergetInteger(Object anObj) Returns the Integer for a given object.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 longReturns the long value for a given object (assumed to be a string or number).static NumbernumberValue(Object anObj) Returns the Number for a given object (assumed to be Number or String).static voidprintlnOnce(PrintStream aStream, String aString) Does a println of a given message to given print writer once.static voidSets this JVM to be headless.static StringstringValue(Object anObj) Returns a String for a given arbitrary object.static voidwriteBytes(byte[] bytes, Object aDest) Writes the given bytes to the given output object (string path or file).
- 
Field Details- 
isWindowspublic static boolean isWindows
- 
isMacpublic static boolean isMac
- 
isApppublic static boolean isApp
- 
isEmbeddedpublic static boolean isEmbedded
- 
isAppletpublic static boolean isApplet
- 
isJava5public static boolean isJava5
- 
isJava6public static boolean isJava6
- 
isJava7public static boolean isJava7
 
- 
- 
Constructor Details- 
RMUtilspublic RMUtils()
 
- 
- 
Method Details- 
boolValueReturns a boolean value for the given object.
- 
intValueReturns the int value for a given object (assumed to be a string or number).
- 
longValueReturns the long 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).
- 
stringValueReturns a String for a given arbitrary object.
- 
booleanValueReturns the Boolean for a given object (assumed to be Number or String).
- 
numberValueReturns the Number for a given object (assumed to be Number or String).
- 
getIntegerReturns the Integer for a given object.
- 
getFloatReturns a Float for a given object.
- 
getDoubleReturns a Double for a given object.
- 
getBigDecimalReturns the BigDecimal for a given object (assumed to be a string or number).
- 
getDateReturns a date for given object of arbitrary type.
- 
addReturns the sum of the two given objects (assumed to be strings or numbers).
- 
clonepublic static <T> T clone(T anObj) Returns a clone of the given object (supports List, Map, RMObject, null and others by reflection).
- 
cloneDeeppublic static <T> T cloneDeep(T anObj) Clones the given object, recursively, if the object is a collection.
- 
equalsReturns whether two objects are equal (supports either being null).
- 
compareReturns result of comparing two values.
- 
getTempDirReturns the temp directory for this machine.
- 
getBytesReturns a byte array from a File, String path, InputStream, URL, byte[], etc.
- 
getBytesReturns bytes for an input stream.
- 
getBytes2Returns bytes for an input stream.- Throws:
- IOException
 
- 
getInputStreamReturns an input stream from a File, String path, URL, byte array, InputStream, etc.
- 
writeBytesWrites the given bytes to the given output object (string path or file).
- 
checkStringChecks a string to see if it's valid.
- 
getHostnameReturns the hostname for this machine.
- 
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.
- 
setHeadlesspublic static void setHeadless()Sets this JVM to be headless.
- 
getIdReturns a unique id for a string each time it's called, starting with 0.
- 
doOnceReturns whether to do something once based on given unique id string.
- 
printlnOnceDoes a println of a given message to given print writer once.
 
-