|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.chenillekit.core.resources.URIResource
public class URIResource
A resource stored with in any location (local, remote or jar archive).
| Constructor Summary | |
|---|---|
URIResource(File file)
|
|
URIResource(String uri)
|
|
URIResource(URI uri)
|
|
URIResource(URL url)
|
|
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
|
boolean |
exists()
Returns true if the resource exists; if a stream to the content of the file may be openned. |
Resource |
forFile(String relativePath)
Returns a Resource based on a relative path, relative to the folder containing the resource. |
Resource |
forLocale(Locale locale)
Returns a localized version of the resource. |
String |
getFile()
Returns the file portion of the Resource path, everything that follows the final forward slash. |
String |
getFolder()
Returns the portion of the path up to the last forward slash; this is the directory or folder portion of the Resource. |
String |
getPath()
Return the path (the combination of folder and file). |
int |
hashCode()
|
protected Resource |
newResource(String uri)
|
InputStream |
openStream()
Opens a stream to the content of the resource, or returns null if the resource does not exist. |
String |
toString()
|
URL |
toURL()
Returns the URL for the resource, or null if it does not exist. |
Resource |
withExtension(String extension)
Returns a new Resource with the extension changed (or, if the resource does not have an extension, the extension is added). |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public URIResource(String uri)
public URIResource(URI uri)
throws MalformedURLException
MalformedURLException
public URIResource(File file)
throws MalformedURLException
MalformedURLException
public URIResource(URL url)
throws URISyntaxException,
MalformedURLException
URISyntaxException
MalformedURLException| Method Detail |
|---|
protected Resource newResource(String uri)
public boolean exists()
exists in interface Resource
public InputStream openStream()
throws IOException
openStream in interface ResourceIOExceptionpublic URL toURL()
toURL in interface Resourcepublic Resource forLocale(Locale locale)
forLocale in interface Resourcepublic Resource forFile(String relativePath)
forFile in interface Resourcepublic Resource withExtension(String extension)
toURL() may return null.
withExtension in interface Resourceextension - to apply to the resource, such as "html" or "properties"
public String getFolder()
getFolder in interface Resourcepublic String getFile()
getFile in interface Resourcepublic String getPath()
getPath in interface Resourcepublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||