|
|||||||||||
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.ClassResource
Resource of some Class. The resource is read by calling [resource-owner-class].getResourceAsStream([resource-name])
Class
,
ClassLoader
,
Class.getResourceAsStream(java.lang.String)
,
Class.getResource(java.lang.String)
Constructor Summary | |
ClassResource(java.lang.Class resourceOwnerClass,
java.lang.String resourceName)
|
Method Summary | |
java.io.InputStream |
getInputStream()
A primary way reading the resource. |
Resource |
getResource(java.lang.String relativePath)
Locates another Resource whose path is defined relative to this Resource. |
java.lang.String |
getResourceName()
not same as the getIdentifier(), which is prefixed with the name of the owner class.. |
java.lang.Class |
getResourceOwnerClass()
|
java.net.URL |
getUrl()
|
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, getReader, setMimeType, toString, writeTo, writeTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ClassResource(java.lang.Class resourceOwnerClass, java.lang.String resourceName)
resourceOwnerClass
- the Class that own the resource. specifies the
location of the actual file.resourceName
- The name of the resource, given for method
Class.getResourceAsStream()
.Class.getResourceAsStream(java.lang.String)
,
Class.getResource(java.lang.String)
Method Detail |
public java.lang.Class getResourceOwnerClass()
public java.lang.String getResourceName()
public java.net.URL getUrl() throws java.io.IOException
getUrl
in interface UrlReadable
java.io.IOException
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 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 |