|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bankframe.services.resource.ResourceLocator
public class ResourceLocator
This class provides utility methods for locating classes and resource files in the class path, and for accessing classes and resource files
Constructor Summary | |
---|---|
ResourceLocator()
Default Constructor |
Method Summary | |
---|---|
static URL |
getClassInClassPath(Class clazz,
String className,
Locale locale)
This method gets the URL for the specified class and locale. |
static URL |
getClassInClassPath(String className)
This method gets the URL for the specified class. |
static URL |
getClassInClassPath(String className,
Locale locale)
This method gets the URL for the specified class and locale . |
static URL |
getFileInClassPath(String fullFileName)
This method gets the URL for the specified file. |
static URL |
getFileInClassPath(String fileName,
String fileExtension)
This method gets the URL for the specified file. |
static InputStream |
getInputStream(URL url)
This method gets an InputStream for the specified URL. |
static long |
getLastModified(URL url)
This method returns the time (in milliseconds since 01/01/1970) that the resource was last modified. |
static OutputStream |
getOutputStream(URL url)
This method gets an OutputStream for the specified URL. |
static URL |
getResourceInClassPath(Class clazz,
String resourceName,
Locale locale)
This method gets the URL for the specified resource and locale . |
static URL |
getResourceInClassPath(String resourceName)
This method gets the URL for the specified resource and locale . |
static URL |
getResourceInClassPath(String resourceName,
Locale locale)
This method gets the URL for the specified resource and locale . |
static boolean |
isReadOnly(URL url)
This method checks if the specified resource is read only. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceLocator()
Method Detail |
---|
public static URL getClassInClassPath(Class clazz, String className, Locale locale)
com.bankframe.resource.ResourceLocator
. This method will
locate the nearest matching locale to the one requested. This method will
return null if the class cannot be found in the classpath.
clazz
- the Class instance to use to search the class pathclassName
- the name of the classlocale
- the locale
public static URL getClassInClassPath(String className)
com.bankframe.resource.ResourceLocator
.
This method will return null if the class cannot be found in the class path.
className
- the name of the class
public static URL getClassInClassPath(String className, Locale locale)
com.bankframe.resource.ResourceLocator
.
This method will locate the nearest matching locale to the one requested. This method
will return null if the class cannot be found in the class path.
className
- the name of the classlocale
- the locale
public static URL getFileInClassPath(String fullFileName)
fullFileName
- the name of the file to search for in the classpath
public static URL getFileInClassPath(String fileName, String fileExtension)
fileName
- the name of the file (excluding the extension)fileExtension
- the file extension (e.g. .jpg, .gif)
public static InputStream getInputStream(URL url) throws IOException
url
- the URL of the resource
IOException
public static long getLastModified(URL url)
url
- the URL of the resource
public static OutputStream getOutputStream(URL url) throws IOException
java.io.IOException
being thrown.
url
- the URL of the resource
IOException
- if the resource is read-onlypublic static URL getResourceInClassPath(Class clazz, String resourceName, Locale locale)
com.bankframe.localization.messages.BankframeMessages
.
This method will locate the nearest matching locale to the one requested. This method
will return null if the resource cannot be found in the classpath.
clazz
- The Class instance to use to search the class pathresourceName
- Name of the resourcelocale
- The locale
public static URL getResourceInClassPath(String resourceName)
com.bankframe.localization.messages.BankframeMessages
.
This method will locate the nearest matching locale to the one requested. This
method will return null if the resource cannot be found in the classpath.
resourceName
- Name of the resource
public static URL getResourceInClassPath(String resourceName, Locale locale)
com.bankframe.localization.messages.BankframeMessages
.
This method will locate the nearest matching locale to the one requested. This method
will return null if the resource cannot be found in the classpath.
resourceName
- the nName of the resourcelocale
- the locale
public static boolean isReadOnly(URL url)
url
- the URL of the resource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |