|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttranslator.ResourceLocator
public class ResourceLocator
This class encapsulates the loading of (almost) arbitrary resources. Resource loading is performed by checking the following approaches:
Class.getResourceAsStream()ClassLoader.getSystemResourceAsStream()FileInputStream (not possible for Applets
and WebStart applications)
| Constructor Summary | |
|---|---|
ResourceLocator()
(empty) default constructor |
|
| Method Summary | |
|---|---|
static ResourceLocator |
getResourceLocator()
returns the current (internal) locator, creating a new one first if needed |
java.io.InputStream |
getResourceStream(java.lang.String resourceName)
Retrieve a resource by its name in String format |
java.io.InputStream |
getResourceStream(java.lang.String resourceName,
boolean runsAsApplet,
java.net.URL codeBaseName)
Retrieve a resource by its name in String format, a boolean indicating if the current environment is an Applet, and the codebase, if so. |
java.io.InputStream |
getResourceStream(java.lang.String resourceName,
java.lang.String extension)
Retrieve a resource by its name and extension in String format |
java.io.InputStream |
getResourceStream(java.lang.String resourceName,
java.lang.String extension,
boolean runsAsApplet,
java.net.URL codeBase)
Retrieve a resource by its name and extension in String format, a boolean indicating if the current environment is an Applet, and the codebase, if so. |
java.io.InputStream |
getResourceStream(java.lang.String resourceName,
java.lang.String extension,
java.lang.String directoryName)
Retrieve a resource by its name and extension plus directory in String format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResourceLocator()
| Method Detail |
|---|
public static ResourceLocator getResourceLocator()
public java.io.InputStream getResourceStream(java.lang.String resourceName)
resourceName - the name of the resource to be loaded
InputStream to the resource. May be null if none
of the approaches taken can locate the resource.getResourceStream(String, String, boolean, URL)
public java.io.InputStream getResourceStream(java.lang.String resourceName,
java.lang.String extension)
resourceName - the name of the resource to be loadedextension - the filename extension, important e.g. for I18N applications where
the filename encodes the locale.
InputStream to the resource. May be null if none
of the approaches taken can locate the resource.getResourceStream(String, String, boolean, URL)
public java.io.InputStream getResourceStream(java.lang.String resourceName,
boolean runsAsApplet,
java.net.URL codeBaseName)
resourceName - the name of the resource to be loadedrunsAsApplet - indicates if this is an Application (=false) or
an Applet (=true)codeBaseName - the URL pointing towards the Applet's codebase, if this is
actually an Applet (runsAsApplet == true)
InputStream to the resource. May be null if none
of the approaches taken can locate the resource.getResourceStream(String, String, boolean, URL)
public java.io.InputStream getResourceStream(java.lang.String resourceName,
java.lang.String extension,
java.lang.String directoryName)
resourceName - the name of the resource to be loadedextension - the filename's extension (if any - else null)directoryName - the path for the file
InputStream to the resource. May be null if none
of the approaches taken can locate the resource.getResourceStream(String, String, boolean, URL)
public java.io.InputStream getResourceStream(java.lang.String resourceName,
java.lang.String extension,
boolean runsAsApplet,
java.net.URL codeBase)
resourceName - the name of the resource to be loadedextension - the filename's extension (if any - else null)runsAsApplet - indicates if this is an Application (=false) or
an Applet (=true)codeBase - the URL pointing towards the Applet's codebase, if this is
actually an Applet (runsAsApplet == true)
InputStream to the resource. May be null if none
of the approaches taken can locate the resource.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||