ResourceFactoryJarResourcepublic class URLResource extends Resource
| Modifier and Type | Field | Description |
|---|---|---|
protected java.net.URLConnection |
_connection |
|
protected java.io.InputStream |
_in |
|
protected java.net.URL |
_url |
|
protected java.lang.String |
_urlString |
__defaultUseCaches| Modifier | Constructor | Description |
|---|---|---|
protected |
URLResource(java.net.URL url,
java.net.URLConnection connection) |
|
protected |
URLResource(java.net.URL url,
java.net.URLConnection connection,
boolean useCaches) |
| Modifier and Type | Method | Description |
|---|---|---|
Resource |
addPath(java.lang.String path) |
Returns the resource contained inside the current resource with the
given name
|
protected boolean |
checkConnection() |
|
void |
close() |
Release any resources held by the resource.
|
boolean |
delete() |
Deletes the given resource
|
boolean |
equals(java.lang.Object o) |
|
boolean |
exists() |
Returns true if the represented resource exists.
|
java.io.File |
getFile() |
Returns an File representing the given resource or NULL if this
is not possible.
|
java.io.InputStream |
getInputStream() |
Returns an input stream to the resource.
|
protected java.io.InputStream |
getInputStream(boolean resetConnection) |
Returns an input stream to the resource, optionally nulling
out the underlying url connection.
|
java.lang.String |
getName() |
Returns the name of the resource
|
java.nio.channels.ReadableByteChannel |
getReadableByteChannel() |
Readable ByteChannel for the resource.
|
java.net.URL |
getURL() |
Returns an URL representing the given resource
|
boolean |
getUseCaches() |
|
int |
hashCode() |
|
boolean |
isContainedIn(Resource containingResource) |
|
boolean |
isDirectory() |
Returns true if the represented resource is a container/directory.
|
long |
lastModified() |
Returns the last modified time
|
long |
length() |
Return the length of the resource
|
java.lang.String[] |
list() |
Returns a list of resource names contained in the given resource
|
boolean |
renameTo(Resource dest) |
Rename the given resource
|
java.lang.String |
toString() |
copyTo, encode, finalize, getAlias, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getResource, getURI, getWeakETag, getWeakETag, isAlias, isContainedIn, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, release, setAssociate, setDefaultUseCaches, toURL, writeToprotected final java.net.URL _url
protected final java.lang.String _urlString
protected java.net.URLConnection _connection
protected java.io.InputStream _in
protected URLResource(java.net.URL url,
java.net.URLConnection connection)
protected URLResource(java.net.URL url,
java.net.URLConnection connection,
boolean useCaches)
protected boolean checkConnection()
public void close()
public boolean exists()
public boolean isDirectory()
isDirectory in class Resourcepublic long lastModified()
lastModified in class Resourcepublic long length()
public java.net.URL getURL()
public java.io.File getFile()
throws java.io.IOException
public java.lang.String getName()
public java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in class Resourcejava.io.IOException - if unable to open the input streamprotected java.io.InputStream getInputStream(boolean resetConnection)
throws java.io.IOException
resetConnection - if true the connection field is set to nulljava.io.IOException - if unable to open the input streampublic java.nio.channels.ReadableByteChannel getReadableByteChannel()
throws java.io.IOException
ResourcegetReadableByteChannel in class Resourcejava.io.IOException - if unable to open the readable bytechannel for the resource.public boolean delete()
throws java.lang.SecurityException
public boolean renameTo(Resource dest) throws java.lang.SecurityException
public java.lang.String[] list()
public Resource addPath(java.lang.String path) throws java.io.IOException, java.net.MalformedURLException
addPath in class Resourcepath - The path segment to add, which is not encodedjava.io.IOException - if unable to resolve the pathjava.net.MalformedURLException - if the resolution of the path fails because the input path parameter is malformed.public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic boolean getUseCaches()
public boolean isContainedIn(Resource containingResource) throws java.net.MalformedURLException
isContainedIn in class Resourcejava.net.MalformedURLExceptionCopyright © 1995–2018 Webtide. All rights reserved.