org.kuali.rice.core.api.util
Class RiceUtilities

java.lang.Object
  extended by org.kuali.rice.core.api.util.RiceUtilities

public final class RiceUtilities
extends Object

Author:
Kuali Rice Team (rice.collab@kuali.org)

Method Summary
static
<T extends Throwable>
T
findExceptionInStack(Throwable topLevelException, Class<T> exceptionClass)
          This method searches for an exception of the specified type in the stack trace of the given exception.
static String getFileSizeUnits(Long fileSize)
          Converts a given file size in bytes to a unit of bytes, kilobyte, megabyte, or gigabyte
static String getHostName()
           
static String getIpNumber()
           
static InputStream getResourceAsStream(String resourceLoc)
          Attempts to retrieve the resource stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getIpNumber

public static String getIpNumber()

getHostName

public static String getHostName()

getResourceAsStream

public static InputStream getResourceAsStream(String resourceLoc)
                                       throws MalformedURLException,
                                              IOException
Attempts to retrieve the resource stream.

Parameters:
resourceLoc - resource location; syntax supported by DefaultResourceLoader
Returns:
the resource stream or null if the resource could not be obtained
Throws:
MalformedURLException
IOException
See Also:
DefaultResourceLoader

findExceptionInStack

public static <T extends Throwable> T findExceptionInStack(Throwable topLevelException,
                                                           Class<T> exceptionClass)
This method searches for an exception of the specified type in the stack trace of the given exception.

Parameters:
topLevelException - the exception whose stack to traverse
exceptionClass - the exception class to look for
Returns:
the first instance of an exception of the specified class if found, or null otherwise

getFileSizeUnits

public static String getFileSizeUnits(Long fileSize)
Converts a given file size in bytes to a unit of bytes, kilobyte, megabyte, or gigabyte

Parameters:
fileSize - - size in bytes
Returns:
String with format 'size units'


Copyright © 2005-2014 The Kuali Foundation. All Rights Reserved.