| java.lang.Object org.jzonic.jlo.reader.ResourceLocator
ResourceLocator | public class ResourceLocator implements Serializable(Code) | | 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.
author: Andreas Mecky author: Terry Dye |
ResourceLocator | public ResourceLocator()(Code) | | Creates a new instance of ResourceLocator
|
findResource | public InputStream findResource(String fileName)(Code) | | Method findResource.
Parameters: fileName - InputStream |
getDirectory | public String getDirectory()(Code) | | Returns the directory containing the resource, or null if the
resource isn't directly available on the filesystem.
This value can be used to locate the configuration file on disk,
or to write files in the same directory.
|
getName | public String getName()(Code) | | Returns the resource name, as passed to the constructor
|
lastModified | public long lastModified()(Code) | | Returns when the resource was last modified. If the resource
was found using a URL, this method will work only if the URL
connection supports last modified information. If there's no
support, Long.MAX_VALUE is returned. Perhaps this should return
-1, but you should return MAX_VALUE on the assumption that if
you can't determine the time, it's maximally new.
|
|
|