Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

oracle.adfnmc.util
Class Utility

java.lang.Object
  extended by oracle.adfnmc.util.Utility

public class Utility
extends java.lang.Object

Contains miscellaneous utility functions


Field Summary
static java.lang.String ADFCONFIG_NAME
           
static java.lang.String AMC_NAMESPACE
           
static java.lang.Class BOOLEAN_CLASS
           
static java.lang.String BOOLEAN_CLASS_NAME
           
static java.lang.Class BYTE_CLASS
           
static java.lang.String BYTE_CLASS_NAME
           
static java.lang.Class CHARACTER_CLASS
           
static java.lang.String CHARACTER_CLASS_NAME
           
static java.lang.Class CLASS_INSTANCE
           
static java.lang.String CLASS_INSTANCE_NAME
           
static int COMPARISON_INDETERMINATE
           
static java.lang.String CONNECTIONS_NAME
           
static java.lang.String CRLF
           
static java.lang.Class DATE_CLASS
           
static java.lang.String DATE_CLASS_NAME
           
static java.lang.String DB_CONNECTION_KEY
           
static java.lang.String DB_CONNECTIONCLASS_KEY
           
static java.lang.Class DOUBLE_CLASS
           
static java.lang.String DOUBLE_CLASS_NAME
           
static java.lang.String EMPTY_STRING
           
static java.lang.Class FLOAT_CLASS
           
static java.lang.String FLOAT_CLASS_NAME
           
static java.lang.Class INTEGER_CLASS
           
static java.lang.String INTEGER_CLASS_NAME
           
static java.lang.String JAD_FILENAME
           
static java.lang.Class LONG_CLASS
           
static java.lang.String LONG_CLASS_NAME
           
static java.lang.String NMC_NAMESPACE
           
static java.lang.String NULL_NAME
           
static java.lang.Class NUMBER_CLASS
           
static java.lang.String NUMBER_CLASS_NAME
           
static java.lang.Class OBJECT_CLASS
           
static java.lang.String OBJECT_CLASS_NAME
           
static java.lang.String PLATFORM_ALL_STRING
           
static byte PLATFORM_BLACKBERRY
           
static java.lang.String PLATFORM_BLACKBERRY_STRING
           
static byte PLATFORM_UNKNOWN
           
static byte PLATFORM_WIN32
           
static java.lang.String PLATFORM_WIN32_STRING
           
static byte PLATFORM_WMCDC
           
static java.lang.String PLATFORM_WMCDC_STRING
           
static byte PLATFORM_WMMIDP
           
static java.lang.String PLATFORM_WMMIDP_STRING
           
static java.lang.String READWRITE_ROOT_KEY
           
static java.lang.String SCROOT_KEY
           
static java.lang.Class SHORT_CLASS
           
static java.lang.String SHORT_CLASS_NAME
           
static java.lang.String SPLASHSCREEN_DISPLAY
           
static boolean SPLASHSCREEN_DISPLAY_DEFAULT
           
static java.lang.Class STRING_CLASS
           
static java.lang.String STRING_CLASS_NAME
           
static java.lang.Class VECTOR_CLASS
           
static java.lang.String VECTOR_CLASS_NAME
           
 
Constructor Summary
Utility()
           
 
Method Summary
static java.lang.String adjustNameForNull(java.lang.String name)
          Checks if the provided name is null, and if so, returns a predefined String so that consumers (e.g.
static java.util.Vector asList(java.lang.Object[] array)
          Converts an Object array into a Vector
static Vector asOracleList(java.lang.Object[] array)
          Converts an Object array into an Oracle Vector
static java.util.Hashtable clone(java.util.Hashtable input)
          Make a shallow copy of the input Hashtable.
static java.util.Vector clone(java.util.Vector input)
          Make a shallow copy of the input Vector
static void closeSilently(java.io.InputStream is)
          Close the specified InputStream and ignore any IOException that may be thrown as a result
static void closeSilently(java.io.OutputStream os)
          Close the specified OutputStream and ignore any IOException that may be thrown as a result
static int comparePossiblyNullObjects(java.lang.Object object1, java.lang.Object object2)
           
static java.lang.Object[] elementsToArray(java.util.Hashtable ht)
          Gets the elements of a Hashtable as an array
static java.lang.String firstPathThatExists(java.lang.String[] pathsToTry)
          Simply returns the first path that exists, given a list of paths to try
static java.lang.String formatMessage(java.lang.String originalMsg, java.lang.Object[] params)
          Replace named parameters in a string with the actual parameter values.
static java.lang.String fullMethodNameToClassName(java.lang.String fullName)
          Converts a fully-qualified methodname, like "oracle.adfnmc.Calculator.add", to just the class name, "oracle.adfnmc.Calculator".
static java.lang.String fullMethodNameToMethodName(java.lang.String fullName)
          Converts a fully-qualified methodname, like "oracle.adfnmc.Calculator.add", to just the method name, "add".
static java.lang.String fullNameToPathName(java.lang.String fullName)
           
static java.lang.String fullNameToPropertiesFileName(java.lang.String fullName)
           
static java.lang.String fullNameToShortName(java.lang.String fullName)
          Convert a fully-qualified classname, like "oracle.adfnmc.model.Products", to a short name like "Products"
static java.lang.String fullNameToXliffFileName(java.lang.String fullName)
           
static java.lang.String fullNameToXmlFileName(java.lang.String fullName)
          Convert a fully-qualified classname, like "oracle.adfnmc.model.Products", to a filename relative to the predefined resources base directory, like "/res/oracle/adfnmc/model/Products.xml"
static java.lang.String fullyQualifyAppMetadataResourceName(java.lang.String resName)
          Prepends a resource name with the dooted name converted application metadata base path, e.g.:
Application metadata base dir: res/app/
resName: oracle.adfnmc.test.MessageBundle
result = res.app.oracle.adfnmc.test.MessageBundle
static java.lang.String getAppConfigDefinedDir(java.lang.String key, java.lang.String defaultVal, boolean isJarPath)
          Utility method for getting application file configurable paths.
static PropertyBag getAppConfigFile()
          Get the properties for this application.
static Map getAppConfigFileAsMap()
           
static java.lang.String getApplicationName()
           
static oracle.adfnmc.javax.naming.Reference getConnection(java.lang.String connectionName)
          Get the connection properties for this application.
static HashMap getConnections()
          Get all the connection properties for this application.
static ResourceLoader getDefaultResourceLoader()
           
static java.lang.String getFormattedMessage(ResourceBundle resourceBundle, java.lang.String key, java.lang.Object[] params)
          Returns a formatted message from the resource bundle.
static java.lang.String getLocaleName(java.lang.String baseName, Locale locale)
          Create a property/bundle name of the form "baseName_language_country_variant".
static java.lang.String getMetadataBasedir()
          Deprecated. - Now just use getRootPath() + the path of the resource relative to the root of the jar it is packaged in
static int[] getOSVersionComponents()
          Get an array of version component numbers.
static java.lang.String getPlatformString()
           
static java.lang.String getProperty(java.lang.String key)
           
static java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
           
static java.lang.String getReadWriteRoot()
           
static java.io.InputStream getResourceAsStream(java.lang.String resName)
          Load the requested resource and return it as an InputStream for reading
static java.lang.String getResourcesBasedir()
          Deprecated. - Now just use getRootPath() + the path of the resource relative to the root of the jar it is packaged in
static java.lang.String getRootPath()
           
static java.lang.String getStorageCardRoot()
           
static java.lang.String handleEscapeChars(java.lang.String str)
           
static void init(java.lang.Object mainClass)
          Entry point for startup code in the Utility layer
static void initDefaultResourceLoader(java.lang.Object mainClass)
          Initialize the default resource loader.
static java.lang.Object instanceForName(java.lang.String className)
          Instantiates a class with a given name.
static boolean isEmpty(java.lang.String s)
          Is the provided string empty?
static boolean isEqual(java.lang.String str1, java.lang.String str2)
          This methd checks for String equality, respecting the difference between a null and empty String
static boolean isJavaIdentifierPart(char ch)
           
static boolean isJavaIdentifierStart(char ch)
           
static boolean isPathAbsolute(java.lang.String sourceId)
          Determines if a specified path is absolute.
static boolean isRunningInAutomatedMode()
          Determines if the adfnmc j2meunit based test harness is running in automated mode
static boolean isRunningInProfiledMode()
          Determines if the adfnmc j2meunit based test harness is running in profiled mode
static boolean isStorageCardPresent()
           
static boolean isWhitespace(char c)
          Determines if the specified character is a whitespace character, like ' ', or '\t'.
static boolean isXmlNamespaceValid(java.lang.String ns)
           
static java.lang.String joinStrings(java.lang.String[] inputs, java.lang.String delimiter)
           
static java.lang.Object[] keysToArray(java.util.Hashtable ht)
          Gets the keys of a Hashtable as an array
static int lastIndexOf(java.lang.String str, java.lang.String val)
           
static void logMsg(java.lang.String logName, Level level, java.lang.Class callingClass, java.lang.String methodName, java.lang.String msg, java.lang.Object[] args, boolean bThrowExc)
          Logs a message and throws AdfNmcException if required.
static java.util.Vector parseBufferIntoLines(java.io.InputStream stream)
          Parse a stream of bytes into lines delimited by CR-LF pairs
static java.lang.String[] processWhiteSpaceInMessage(java.lang.String msg)
           
static void putAll(HashMap source, java.util.Hashtable dest)
           
static void putAll(java.util.Hashtable source, java.util.Hashtable dest)
           
static byte[] readEntireStreamContents(java.io.InputStream is)
           
static java.lang.String replaceString(java.lang.String input, java.lang.String search, java.lang.String replace)
          Replace all occurrences of one string with another in the input string
static boolean resourceExists(java.lang.String resName)
          Does the named resource exist?
static void setSizeInVector(java.util.Vector v, int newSize)
          Resize a Vector to the specified newSize by adding null elements or removing elements as necessary
static void shutdown()
          Entry point for shutdown code in the Utility layer
static boolean stringToBool(java.lang.String str)
          Convert a string to its boolean equivalent.
static boolean stringToBool(java.lang.String str, boolean defaultVal)
          Convert a string to its boolean equivalent.
static java.util.Vector toJavaVector(List list)
           
static java.lang.String[] tokenize(java.lang.String str, java.lang.String delimiter)
          Break apart string into tokens delimited by another string.
static java.lang.String[] tokenize(java.lang.String str, java.lang.String delimiter, int limit)
           
static Vector toOracleVector(List list)
           
static Vector toOracleVector(java.util.Vector src)
           
static java.lang.String[] toStringArray(List list)
           
static java.lang.String urlDecode(java.lang.String input)
          URL decode an input string, e.g.
static java.lang.String urlEncode(java.lang.String input)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOLEAN_CLASS

public static final java.lang.Class BOOLEAN_CLASS

BOOLEAN_CLASS_NAME

public static final java.lang.String BOOLEAN_CLASS_NAME

BYTE_CLASS

public static final java.lang.Class BYTE_CLASS

BYTE_CLASS_NAME

public static final java.lang.String BYTE_CLASS_NAME

CHARACTER_CLASS

public static final java.lang.Class CHARACTER_CLASS

CHARACTER_CLASS_NAME

public static final java.lang.String CHARACTER_CLASS_NAME

DOUBLE_CLASS

public static final java.lang.Class DOUBLE_CLASS

DOUBLE_CLASS_NAME

public static final java.lang.String DOUBLE_CLASS_NAME

FLOAT_CLASS

public static final java.lang.Class FLOAT_CLASS

FLOAT_CLASS_NAME

public static final java.lang.String FLOAT_CLASS_NAME

INTEGER_CLASS

public static final java.lang.Class INTEGER_CLASS

INTEGER_CLASS_NAME

public static final java.lang.String INTEGER_CLASS_NAME

LONG_CLASS

public static final java.lang.Class LONG_CLASS

LONG_CLASS_NAME

public static final java.lang.String LONG_CLASS_NAME

NUMBER_CLASS

public static final java.lang.Class NUMBER_CLASS

NUMBER_CLASS_NAME

public static final java.lang.String NUMBER_CLASS_NAME

OBJECT_CLASS

public static final java.lang.Class OBJECT_CLASS

OBJECT_CLASS_NAME

public static final java.lang.String OBJECT_CLASS_NAME

SHORT_CLASS

public static final java.lang.Class SHORT_CLASS

SHORT_CLASS_NAME

public static final java.lang.String SHORT_CLASS_NAME

STRING_CLASS

public static final java.lang.Class STRING_CLASS

STRING_CLASS_NAME

public static final java.lang.String STRING_CLASS_NAME

DATE_CLASS

public static final java.lang.Class DATE_CLASS

DATE_CLASS_NAME

public static final java.lang.String DATE_CLASS_NAME

VECTOR_CLASS

public static final java.lang.Class VECTOR_CLASS

VECTOR_CLASS_NAME

public static final java.lang.String VECTOR_CLASS_NAME

CLASS_INSTANCE

public static final java.lang.Class CLASS_INSTANCE

CLASS_INSTANCE_NAME

public static final java.lang.String CLASS_INSTANCE_NAME

NMC_NAMESPACE

public static final java.lang.String NMC_NAMESPACE
See Also:
Constant Field Values

AMC_NAMESPACE

public static final java.lang.String AMC_NAMESPACE
See Also:
Constant Field Values

DB_CONNECTIONCLASS_KEY

public static final java.lang.String DB_CONNECTIONCLASS_KEY
See Also:
Constant Field Values

CRLF

public static final java.lang.String CRLF
See Also:
Constant Field Values

NULL_NAME

public static final java.lang.String NULL_NAME
See Also:
Constant Field Values

EMPTY_STRING

public static final java.lang.String EMPTY_STRING
See Also:
Constant Field Values

JAD_FILENAME

public static final java.lang.String JAD_FILENAME

ADFCONFIG_NAME

public static final java.lang.String ADFCONFIG_NAME
See Also:
Constant Field Values

DB_CONNECTION_KEY

public static final java.lang.String DB_CONNECTION_KEY
See Also:
Constant Field Values

CONNECTIONS_NAME

public static final java.lang.String CONNECTIONS_NAME
See Also:
Constant Field Values

PLATFORM_UNKNOWN

public static final byte PLATFORM_UNKNOWN
See Also:
Constant Field Values

PLATFORM_BLACKBERRY

public static final byte PLATFORM_BLACKBERRY
See Also:
Constant Field Values

PLATFORM_WMCDC

public static final byte PLATFORM_WMCDC
See Also:
Constant Field Values

PLATFORM_WMMIDP

public static final byte PLATFORM_WMMIDP
See Also:
Constant Field Values

PLATFORM_WIN32

public static final byte PLATFORM_WIN32
See Also:
Constant Field Values

PLATFORM_ALL_STRING

public static final java.lang.String PLATFORM_ALL_STRING
See Also:
Constant Field Values

PLATFORM_BLACKBERRY_STRING

public static final java.lang.String PLATFORM_BLACKBERRY_STRING
See Also:
Constant Field Values

PLATFORM_WMCDC_STRING

public static final java.lang.String PLATFORM_WMCDC_STRING
See Also:
Constant Field Values

PLATFORM_WMMIDP_STRING

public static final java.lang.String PLATFORM_WMMIDP_STRING
See Also:
Constant Field Values

PLATFORM_WIN32_STRING

public static final java.lang.String PLATFORM_WIN32_STRING
See Also:
Constant Field Values

SCROOT_KEY

public static final java.lang.String SCROOT_KEY
See Also:
Constant Field Values

READWRITE_ROOT_KEY

public static final java.lang.String READWRITE_ROOT_KEY
See Also:
Constant Field Values

SPLASHSCREEN_DISPLAY

public static final java.lang.String SPLASHSCREEN_DISPLAY
See Also:
Constant Field Values

SPLASHSCREEN_DISPLAY_DEFAULT

public static final boolean SPLASHSCREEN_DISPLAY_DEFAULT
See Also:
Constant Field Values

COMPARISON_INDETERMINATE

public static final int COMPARISON_INDETERMINATE
See Also:
Constant Field Values
Constructor Detail

Utility

public Utility()
Method Detail

isXmlNamespaceValid

public static boolean isXmlNamespaceValid(java.lang.String ns)

initDefaultResourceLoader

public static final void initDefaultResourceLoader(java.lang.Object mainClass)
Initialize the default resource loader. This is the object that is responsible for loading resources (XML files, graphics, etc.) from the filesystem or JAR.

Parameters:
mainClass - The class containing the main method. For a MIDP environment, this will be the MIDlet class

getDefaultResourceLoader

public static final ResourceLoader getDefaultResourceLoader()

getRootPath

public static final java.lang.String getRootPath()

getAppConfigDefinedDir

public static java.lang.String getAppConfigDefinedDir(java.lang.String key,
                                                      java.lang.String defaultVal,
                                                      boolean isJarPath)
Utility method for getting application file configurable paths. A slash separator will be appended to the return value, so callers should not insert a slash character between the result of this call and any descendant path strings as they build up a path.

Parameters:
key -
defaultVal -
isJarPath - TODO
Returns:

getResourcesBasedir

public static final java.lang.String getResourcesBasedir()
Deprecated. - Now just use getRootPath() + the path of the resource relative to the root of the jar it is packaged in

Get the application resources directory string. This string defaults to "res" but can be overriden by a configuration file property, "resources-basedir".
A slash separator will be appended to the return value, so callers should not insert a slash character between the result of this call and any descendant path strings as they build up a path.

Returns:

getMetadataBasedir

public static final java.lang.String getMetadataBasedir()
Deprecated. - Now just use getRootPath() + the path of the resource relative to the root of the jar it is packaged in

-Internal- Get the base path for application metadata resources

Returns:

getResourceAsStream

public static final java.io.InputStream getResourceAsStream(java.lang.String resName)
Load the requested resource and return it as an InputStream for reading

Parameters:
resName - Name of resource, like "res/Foo.png" or "/res/SRDEMO.sql"
Returns:
An InputStream if resName was found, or null if it was not

resourceExists

public static final boolean resourceExists(java.lang.String resName)
Does the named resource exist?

Parameters:
resName -
Returns:

readEntireStreamContents

public static final byte[] readEntireStreamContents(java.io.InputStream is)

isEqual

public static boolean isEqual(java.lang.String str1,
                              java.lang.String str2)
This methd checks for String equality, respecting the difference between a null and empty String

Parameters:
str1 - first String to compare
str2 - second String to compare
Returns:
true if the Strings are equal, false if not

isEmpty

public static final boolean isEmpty(java.lang.String s)
Is the provided string empty?

Parameters:
s - string to test
Returns:
true if empty; false if not

stringToBool

public static final boolean stringToBool(java.lang.String str)
Convert a string to its boolean equivalent. Case-insensitive.

Parameters:
str - Input string
Returns:
false if input is "false"; true if input is "true". Throws IllegalArgumentException if neither

stringToBool

public static final boolean stringToBool(java.lang.String str,
                                         boolean defaultVal)
Convert a string to its boolean equivalent. Case-insensitive.

Parameters:
str - Input string
defaultVal - the value to return if str is null
Returns:
false if input is "false"; true if input is "true". Throws IllegalArgumentException if neither

tokenize

public static final java.lang.String[] tokenize(java.lang.String str,
                                                java.lang.String delimiter)
Break apart string into tokens delimited by another string.

Parameters:
str - Input string to tokenize
delimiter - Another string which delimits tokens
Returns:
An array of string tokens

tokenize

public static final java.lang.String[] tokenize(java.lang.String str,
                                                java.lang.String delimiter,
                                                int limit)

clone

public static final java.util.Hashtable clone(java.util.Hashtable input)
Make a shallow copy of the input Hashtable.

Parameters:
input - Hashtable to copy
Returns:
Copy of input

clone

public static final java.util.Vector clone(java.util.Vector input)
Make a shallow copy of the input Vector

Parameters:
input - Vector to copy
Returns:
Copy of input

isWhitespace

public static final boolean isWhitespace(char c)
Determines if the specified character is a whitespace character, like ' ', or '\t'.

Parameters:
c -
Returns:

asList

public static final java.util.Vector asList(java.lang.Object[] array)
Converts an Object array into a Vector

Parameters:
array -
Returns:

asOracleList

public static final Vector asOracleList(java.lang.Object[] array)
Converts an Object array into an Oracle Vector

Parameters:
array -
Returns:

elementsToArray

public static final java.lang.Object[] elementsToArray(java.util.Hashtable ht)
Gets the elements of a Hashtable as an array

Parameters:
ht -
Returns:

keysToArray

public static final java.lang.Object[] keysToArray(java.util.Hashtable ht)
Gets the keys of a Hashtable as an array

Parameters:
ht -
Returns:

parseBufferIntoLines

public static final java.util.Vector parseBufferIntoLines(java.io.InputStream stream)
Parse a stream of bytes into lines delimited by CR-LF pairs

Parameters:
stream -
Returns:
A Vector of String's, each of which represents one line. The CR-LF characters are stripped away. Returns null if there was a problem.

getAppConfigFile

public static final PropertyBag getAppConfigFile()
Get the properties for this application. These are typically stored in a JAD file and then loaded during app initialization

Returns:
A PropertyBag which can be used to retrieve values by String keys

getAppConfigFileAsMap

public static final Map getAppConfigFileAsMap()

getConnection

public static final oracle.adfnmc.javax.naming.Reference getConnection(java.lang.String connectionName)
Get the connection properties for this application. These are stored in a collections.xml file and then loaded during app initialization

Returns:
A PropertyBag which can be used to retrieve values by String keys

getConnections

public static final HashMap getConnections()
Get all the connection properties for this application. These are stored in a collections.xml file and then loaded during app initialization

Returns:
A Hashtable which can be used to retrieve Reference values by String keys

fullNameToXmlFileName

public static final java.lang.String fullNameToXmlFileName(java.lang.String fullName)
Convert a fully-qualified classname, like "oracle.adfnmc.model.Products", to a filename relative to the predefined resources base directory, like "/res/oracle/adfnmc/model/Products.xml"

Parameters:
fullName - Fully-qualified classname, e.g. "oracle.adfnmc.model.Products"
Returns:
Absolute filename, e.g. "/res/oracle/adfnmc/model/Products.xml"

fullNameToPropertiesFileName

public static final java.lang.String fullNameToPropertiesFileName(java.lang.String fullName)

fullNameToXliffFileName

public static final java.lang.String fullNameToXliffFileName(java.lang.String fullName)

getLocaleName

public static final java.lang.String getLocaleName(java.lang.String baseName,
                                                   Locale locale)
Create a property/bundle name of the form "baseName_language_country_variant". Note that if any of the components {language, country, variant} is null or empty, that part (and the preceding underscore) will be omitted from the result.

Parameters:
baseName -
locale -
Returns:

fullNameToPathName

public static final java.lang.String fullNameToPathName(java.lang.String fullName)

fullNameToShortName

public static final java.lang.String fullNameToShortName(java.lang.String fullName)
Convert a fully-qualified classname, like "oracle.adfnmc.model.Products", to a short name like "Products"

Parameters:
fullName -
Returns:
fullName sans package

fullMethodNameToMethodName

public static final java.lang.String fullMethodNameToMethodName(java.lang.String fullName)
Converts a fully-qualified methodname, like "oracle.adfnmc.Calculator.add", to just the method name, "add".

Parameters:
fullName -
Returns:

fullMethodNameToClassName

public static final java.lang.String fullMethodNameToClassName(java.lang.String fullName)
Converts a fully-qualified methodname, like "oracle.adfnmc.Calculator.add", to just the class name, "oracle.adfnmc.Calculator".

Parameters:
fullName -
Returns:

fullyQualifyAppMetadataResourceName

public static final java.lang.String fullyQualifyAppMetadataResourceName(java.lang.String resName)
Prepends a resource name with the dooted name converted application metadata base path, e.g.:
Application metadata base dir: res/app/
resName: oracle.adfnmc.test.MessageBundle
result = res.app.oracle.adfnmc.test.MessageBundle


adjustNameForNull

public static final java.lang.String adjustNameForNull(java.lang.String name)
Checks if the provided name is null, and if so, returns a predefined String so that consumers (e.g. Exception classes) of name don't have to repeatedly perform null checks

Parameters:
name - Name of interest
Returns:
NULL_NAME if null; otherwise, the name itself

formatMessage

public static final java.lang.String formatMessage(java.lang.String originalMsg,
                                                   java.lang.Object[] params)
Replace named parameters in a string with the actual parameter values. Uses '%' as an escape character.

Parameters:
originalMsg - Unformatted message, like "Hello {0}!"
params - Array of objects to use as parameter values, like {"Bob"}
Returns:
Formatted message, like "Hello Bob!"

getFormattedMessage

public static final java.lang.String getFormattedMessage(ResourceBundle resourceBundle,
                                                         java.lang.String key,
                                                         java.lang.Object[] params)
Returns a formatted message from the resource bundle.

Parameters:
resourceBundle - the resource bundle
key - the resource bundle key to lookup
params - array of objects to use as parameter values
Returns:
formatted message from the resource bundle

logMsg

public static void logMsg(java.lang.String logName,
                          Level level,
                          java.lang.Class callingClass,
                          java.lang.String methodName,
                          java.lang.String msg,
                          java.lang.Object[] args,
                          boolean bThrowExc)
Logs a message and throws AdfNmcException if required.

Parameters:
logName - name of the log file
level - severity of the log message
callingClass - class that's invoking this method
methodName - name of the method from which to log a message
msg - log message
args - arguments taken by the log message
bThrowExc - whether to throw an AdfNmcException

closeSilently

public static final void closeSilently(java.io.InputStream is)
Close the specified InputStream and ignore any IOException that may be thrown as a result

Parameters:
is -

closeSilently

public static final void closeSilently(java.io.OutputStream os)
Close the specified OutputStream and ignore any IOException that may be thrown as a result

Parameters:
os -

replaceString

public static final java.lang.String replaceString(java.lang.String input,
                                                   java.lang.String search,
                                                   java.lang.String replace)
Replace all occurrences of one string with another in the input string

Parameters:
input - Input string
search - String to search for
replace - String to replace with
Returns:

setSizeInVector

public static final void setSizeInVector(java.util.Vector v,
                                         int newSize)
Resize a Vector to the specified newSize by adding null elements or removing elements as necessary

Parameters:
v -
newSize -

init

public static final void init(java.lang.Object mainClass)
Entry point for startup code in the Utility layer

Parameters:
mainClass -

shutdown

public static final void shutdown()
Entry point for shutdown code in the Utility layer


urlDecode

public static final java.lang.String urlDecode(java.lang.String input)
URL decode an input string, e.g. replace "%2f" with "/"

Parameters:
input -
Returns:

urlEncode

public static final java.lang.String urlEncode(java.lang.String input)

joinStrings

public static final java.lang.String joinStrings(java.lang.String[] inputs,
                                                 java.lang.String delimiter)

getPlatformString

public static final java.lang.String getPlatformString()

processWhiteSpaceInMessage

public static final java.lang.String[] processWhiteSpaceInMessage(java.lang.String msg)

isJavaIdentifierPart

public static boolean isJavaIdentifierPart(char ch)

isJavaIdentifierStart

public static boolean isJavaIdentifierStart(char ch)

putAll

public static final void putAll(java.util.Hashtable source,
                                java.util.Hashtable dest)

putAll

public static final void putAll(HashMap source,
                                java.util.Hashtable dest)

isRunningInAutomatedMode

public static final boolean isRunningInAutomatedMode()
Determines if the adfnmc j2meunit based test harness is running in automated mode

Returns:

isRunningInProfiledMode

public static final boolean isRunningInProfiledMode()
Determines if the adfnmc j2meunit based test harness is running in profiled mode

Returns:

comparePossiblyNullObjects

public static final int comparePossiblyNullObjects(java.lang.Object object1,
                                                   java.lang.Object object2)

getProperty

public static final java.lang.String getProperty(java.lang.String key)

getProperty

public static final java.lang.String getProperty(java.lang.String key,
                                                 java.lang.String defaultValue)

toJavaVector

public static java.util.Vector toJavaVector(List list)

toOracleVector

public static Vector toOracleVector(List list)

toOracleVector

public static Vector toOracleVector(java.util.Vector src)

toStringArray

public static java.lang.String[] toStringArray(List list)

lastIndexOf

public static int lastIndexOf(java.lang.String str,
                              java.lang.String val)

getStorageCardRoot

public static java.lang.String getStorageCardRoot()

getReadWriteRoot

public static java.lang.String getReadWriteRoot()

isStorageCardPresent

public static boolean isStorageCardPresent()

getOSVersionComponents

public static int[] getOSVersionComponents()
Get an array of version component numbers. So for example, if the platform version was "4.5.0.1", then the array returned would be [4, 5, 0, 1]. Non-numeric components are ignored, so "5.1 build 1700" would result in [5, 1, 1700].

Returns:

getApplicationName

public static java.lang.String getApplicationName()

handleEscapeChars

public static java.lang.String handleEscapeChars(java.lang.String str)

firstPathThatExists

public static java.lang.String firstPathThatExists(java.lang.String[] pathsToTry)
Simply returns the first path that exists, given a list of paths to try

Parameters:
pathsToTry -
Returns:
The first path that exists, or null if none of them does

isPathAbsolute

public static final boolean isPathAbsolute(java.lang.String sourceId)
Determines if a specified path is absolute. This is necessary because not all platforms (e.g. BlackBerry) support creating a File object from an invalid filename, so it's not possible to simply call File.isAbsolute.

Parameters:
sourceId -
Returns:

instanceForName

public static final java.lang.Object instanceForName(java.lang.String className)
Instantiates a class with a given name.

Parameters:
className - name of the class to instantiate
Returns:
instantiated class

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.