|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.uwyn.rife.resources.AbstractResourceFinder
public abstract class AbstractResourceFinder
This abstract class offers common implementations of several
ResourceFinder methods. This makes it easier to implement
specific ResourceFinder classes.
All method implementations here accept resource specification as names and correctly defer the actual logic to the methods that accept resource specification as URLs.
ResourceFinder| Constructor Summary | |
|---|---|
AbstractResourceFinder()
|
|
| Method Summary | ||
|---|---|---|
String |
getContent(String name)
Retrieves the complete content of the resource that corresponds to the provided name. |
|
String |
getContent(String name,
String encoding)
Retrieves the complete content of the resource that corresponds to the provided name. |
|
String |
getContent(URL resource)
Retrieves the complete content of the provided resource. |
|
long |
getModificationTime(String name)
Retrieves the modification time of the resource that corresponds to the provided name. |
|
|
useStream(String name,
InputStreamUser user)
Returns a stream that can be used to read the contents of the resource that corresponds to the provided name. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.uwyn.rife.resources.ResourceFinder |
|---|
getContent, getModificationTime, getResource, useStream |
| Constructor Detail |
|---|
public AbstractResourceFinder()
| Method Detail |
|---|
public <ResultType> ResultType useStream(String name,
InputStreamUser user)
throws ResourceFinderErrorException,
InnerClassException
ResourceFinder
useStream in interface ResourceFindername - the name of the resource to retrieveuser - an instance of InputStreamUser
that contains the logic that will be executed with this stream
useInputStream method of
the provided InputStreamUser instance
ResourceFinderErrorException - when an error occurred during the
creation or opening of the stream.
InnerClassException - when errors occurs inside the
InputStreamUserInputStreamUser,
ResourceFinder.useStream(URL, InputStreamUser)
public String getContent(String name)
throws ResourceFinderErrorException
ResourceFinder
getContent in interface ResourceFindername - the name of the resource to retrieve
String object that contains the complete content
of the resource with the provided name; or
null if the resource couldn't be found.
ResourceFinderErrorException - when an error occurred during the
retrieval of the content.ResourceFinder.getContent(String, String),
ResourceFinder.getContent(URL, String)
public String getContent(String name,
String encoding)
throws ResourceFinderErrorException
ResourceFinder
getContent in interface ResourceFindername - the name of the resource to retrieve the content fromencoding - the encoding that should be used to read the content
String object that contains the complete content
of the resource with the provided name; or
null if the resource couldn't be found.
ResourceFinderErrorException - when an error occurred during the
retrieval of the content or when the encoding is not supported.ResourceFinder.getContent(String),
ResourceFinder.getContent(URL),
ResourceFinder.getContent(URL, String)
public String getContent(URL resource)
throws ResourceFinderErrorException
ResourceFinder
getContent in interface ResourceFinderresource - the resource to retrieve the content from
String object that contains the complete content
of the resource with the provided name; or
null if the resource couldn't be found.
ResourceFinderErrorException - when an error occurred during the
retrieval of the content or when the encoding is not supported.ResourceFinder.getContent(String),
ResourceFinder.getContent(String, String),
ResourceFinder.getContent(URL, String)
public long getModificationTime(String name)
throws ResourceFinderErrorException
ResourceFinder
getModificationTime in interface ResourceFindername - the name of the resource to retrieve
long with the modification time in
milliseconds; or
-1 if the resource couldn't be found.
ResourceFinderErrorException - when an error occurred during the
retrieval of the modification time.ResourceFinder.getModificationTime(URL)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||