edu.princeton.toy
Class TResourceLoader

java.lang.Object
  extended by edu.princeton.toy.TResourceLoader

public abstract class TResourceLoader
extends Object

TResourceLoader is a convenient library of functions which allow the other classes to easily access resources from within the JAR file. In centralizing all resource loading, we also give ourselves the ability to change the implementation easily.


Constructor Summary
TResourceLoader()
           
 
Method Summary
static BufferedReader getBufferedReader(String path)
          Returns the BufferedReader object for a JARed file.
static Image getImage(String path)
          Returns the Image object for a JARed picture.
static InputStream getInputStream(String path)
          Returns the InputStream object for a JARed file.
static Reader getReader(String path)
          Returns the Reader object for a JARed file.
static URL getUrl(String path)
          Returns the URL object for a JARed resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TResourceLoader

public TResourceLoader()
Method Detail

getUrl

public static URL getUrl(String path)
Returns the URL object for a JARed resource.

Parameters:
path - The path of the resource relative to the root of the JAR archive.
Returns:
The URL corresponding to the JARed resource.

getImage

public static Image getImage(String path)
Returns the Image object for a JARed picture.

Parameters:
path - The path of the picture relative to the root of the JAR archive.
Returns:
The Image corresponding to the JARed picture.

getInputStream

public static InputStream getInputStream(String path)
                                  throws IOException
Returns the InputStream object for a JARed file.

Parameters:
path - The path of the file relative to the root of the JAR archive.
Returns:
The InputStream which reads from that file.
Throws:
IOException

getReader

public static Reader getReader(String path)
                        throws IOException
Returns the Reader object for a JARed file.

Parameters:
path - The path of the file relative to the root of the JAR archive.
Returns:
The Reader which reads from that file.
Throws:
IOException

getBufferedReader

public static BufferedReader getBufferedReader(String path)
                                        throws IOException
Returns the BufferedReader object for a JARed file.

Parameters:
path - The path of the file relative to the root of the JAR archive.
Returns:
The BufferedReader which reads from that file.
Throws:
IOException