|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jconfig.utils.ResourceLocator
Adopted from Servlet Best Practices, Part 1 A class to locate resources, retrieve their contents, and determine their last modified time. To find the resource the class searches the CLASSPATH first, then Resource.class.getResource("/" + name). If the Resource finds a "file:" URL, the file path will be treated as a file. Otherwise, the path is treated as a URL and has limited last modified info.
Constructor Summary | |
ResourceLocator(java.lang.String name)
|
Method Summary | |
java.io.InputStream |
findResource(java.lang.String fileName)
Method findResource. |
java.lang.String |
getDirectory()
Returns the directory containing the resource, or null if the resource isn't directly available on the filesystem. |
java.io.File |
getFile()
Returns the file. |
java.io.InputStream |
getInputStream()
Returns an input stream to read the resource contents |
java.lang.String |
getName()
Returns the resource name, as passed to the constructor |
long |
lastModified()
Returns when the resource was last modified. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ResourceLocator(java.lang.String name) throws java.io.IOException
Method Detail |
public java.io.InputStream findResource(java.lang.String fileName)
fileName
-
public java.lang.String getName()
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public long lastModified()
public java.lang.String getDirectory()
public java.lang.String toString()
public java.io.File getFile()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |