|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kiwi.util.ResourceLoader
A utility class containing methods for retrieving application resources; these resources typically reside within a JAR file among the classes that make up an application. The location of a resource is specified as a path relative to the location of a class within the application's class hierarchy. This "anchor class" is specified in the constructor.
Resources may be retrieved as byte arrays, as String
s, as
InputStream
s, as AudioClip
s, as
Image
s,, or as Properties
objects.
See ResourceManager
for a higher-level interface.
CompressedResourceLoader
,
ResourceManager
Field Summary | |
protected Class |
clazz
The class object associated with this resource loader. |
Constructor Summary | |
ResourceLoader(Class clazz)
Construct a new ResourceLoader . |
Method Summary | |
AudioClip |
getResourceAsAudioClip(String path)
Retrieve a resource as an AudioClip . |
Image |
getResourceAsImage(String path)
Retrieve a resource as an Image . |
Properties |
getResourceAsProperties(String path)
Retrieve a resource as a Properties object. |
InputStream |
getResourceAsStream(String path)
Retrieve a resource as a stream. |
String |
getResourceAsString(String path)
Retrieve a resource as a String . |
URL |
getResourceAsURL(String path)
Retrieve a resource as a URL. |
boolean |
imageUpdate(Image img,
int infoflags,
int x,
int y,
int w,
int h)
Image tracker method. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected Class clazz
Constructor Detail |
public ResourceLoader(Class clazz)
ResourceLoader
. A new resource loader is
created with a default input buffer size.Method Detail |
public URL getResourceAsURL(String path)
path
- The location of the resource.URL
reference to the resource.public InputStream getResourceAsStream(String path) throws IOException
path
- The location of the resource.InputStream
from which the resource data may be
read.public final String getResourceAsString(String path) throws IOException
String
. Retrieves the specified
resource, returning its data as a String
. It is assumed that
the resource contains printable text.path
- The location of the resource.public final AudioClip getResourceAsAudioClip(String path)
AudioClip
. Retrieves the specified
resource, returning its data as an AudioClip
. It is assumed
that the resource contains valid audio data.path
- The location of the resource.public final Image getResourceAsImage(String path)
Image
. Retrieves the specified
resource, returning its data as an Image
. It is assumed that
the resource contains valid image data.path
- The location of the resource.public final Properties getResourceAsProperties(String path) throws IOException
Properties
object. Retrieves the
specified resource, returning its data as a Properties
object. It is assumed that the resource is a properly-formatted property
list.path
- The location of the resource.public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |