|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ahc.io.ResourceLoader
This class serves to retrieve resources from the class path, i.e. it allows clients to access the contents of files (e.g. images) that are in the classpath. This is often better than reading from the file system because it reduces installation hassle, works in application servers etc.
Constructor Summary | |
ResourceLoader()
|
Method Summary | |
static byte[] |
getAsBytes(java.lang.String name)
This is a convenience method that reads an entire resource and returns it as a byte array. |
static javax.swing.ImageIcon |
getAsImageIcon(java.lang.String name)
This is a convenience method that reads an entire resource and returns it as an ImageIcon. |
static java.io.InputStream |
getAsStream(java.lang.String name)
This is the underlying method of this class; it provides access to a resource. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ResourceLoader()
Method Detail |
public static java.io.InputStream getAsStream(java.lang.String name)
"images/MyImage.jpg"
for an image in the subdirectory "images", or
"ahc/util/ResourceLoader.class
for the class file of this class.
If the resource is not found null
is returned.
public static byte[] getAsBytes(java.lang.String name)
If the resource is not found, an IllegalArgumentException is thrown.
public static javax.swing.ImageIcon getAsImageIcon(java.lang.String name)
If the resource is not found, an IllegalArgumentException is thrown.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |