|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jicengine.io.AbstractResource
org.jicengine.io.StringResource
A virtual resource whose content is a String, instead of a file on disc.
StringResource makes it possible to create resource-content dynamically and feed it to applications like any other resource.
StringResource needs a 'locator resource' that specifies the 'location' of this virtual resource. StringResource doesn't implement the getResource() method by itself but forwards the call to its locator resource.
Constructor Summary | |
StringResource(java.lang.String identifier,
java.lang.String text,
Resource locatorResource)
|
Method Summary | |
java.io.InputStream |
getInputStream()
A primary way reading the resource. |
java.io.Reader |
getReader()
Simple implementation of getReader() that
wraps the InputStream obtained from getInputStream()
with a InputStreamReader .
|
Resource |
getResource(java.lang.String relativePath)
Locates another Resource whose path is defined relative to this Resource. |
java.lang.String |
getText()
|
boolean |
isAvailable()
Determines the availability of the Resource by calling getInputStream() : resource is available if the method doesn't
throw an exception.
|
Methods inherited from class org.jicengine.io.AbstractResource |
getIdentifier, getMimeType, setMimeType, toString, writeTo, writeTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public StringResource(java.lang.String identifier, java.lang.String text, Resource locatorResource)
locatorResource
- a resource that gives this virtual resource a location.
if the StringResource is created from some source resources through some kind
of a transformation, these source resources would be good candidates for
a locatorResource.Method Detail |
public java.lang.String getText()
public boolean isAvailable()
AbstractResource
Determines the availability of the Resource by calling
getInputStream()
: resource is available if the method doesn't
throw an exception.
Override this if a more efficient way for determining the availability is possible.
isAvailable
in interface Resource
isAvailable
in class AbstractResource
public java.io.InputStream getInputStream() throws java.io.IOException
Resource
getInputStream
in interface Resource
getInputStream
in class AbstractResource
java.io.IOException
public java.io.Reader getReader() throws java.io.IOException
AbstractResource
Simple implementation of getReader()
that
wraps the InputStream
obtained from getInputStream()
with a InputStreamReader
.
Override this method if a better alternative for creating the Reader
is available.
getReader
in interface Resource
getReader
in class AbstractResource
java.io.IOException
public Resource getResource(java.lang.String relativePath) throws java.io.IOException
Resource
Locates another Resource whose path is defined relative to this Resource.
the path scheme used with files and urls is used for specifying relative paths.
the method generally returns instances of the same Resource-subclass than the current instance, but this is not obligatory.
NOTE:
NOTE: there is no support for absolute paths. yet.
getResource
in interface Resource
getResource
in class AbstractResource
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |