public class FileResource extends URLResource
_connection, _in, _url, _urlString__defaultUseCaches| Constructor and Description |
|---|
FileResource(URL url) |
| Modifier and Type | Method and Description |
|---|---|
Resource |
addPath(String path)
Returns the resource contained inside the current resource with the
given name
|
void |
copyTo(File destination) |
boolean |
delete()
Deletes the given resource
|
String |
encode(String uri)
Encode according to this resource type.
|
boolean |
equals(Object o) |
boolean |
exists()
Returns true if the resource exists.
|
URL |
getAlias() |
File |
getFile()
Returns an File representing the given resource or NULL if this
is not possible.
|
InputStream |
getInputStream()
Returns an input stream to the resource
|
String |
getName()
Returns the name of the resource
|
ReadableByteChannel |
getReadableByteChannel()
Returns an readable bytechannel to the resource or null if one is not available.
|
int |
hashCode() |
boolean |
isDirectory()
Returns true if the respresenetd resource is a container/directory.
|
long |
lastModified()
Returns the last modified time
|
long |
length()
Return the length of the resource
|
String[] |
list()
Returns a list of resources contained in the given resource
|
boolean |
renameTo(Resource dest)
Rename the given resource
|
checkConnection, getURL, getUseCaches, isContainedIn, release, toStringfinalize, getAssociate, getDefaultUseCaches, getListHTML, getResource, getURI, getWeakETag, isContainedIn, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, setAssociate, setDefaultUseCaches, toURL, writeTopublic FileResource(URL url) throws IOException, URISyntaxException
IOExceptionURISyntaxExceptionpublic Resource addPath(String path) throws IOException, MalformedURLException
URLResourceaddPath in class URLResourcepath - The path segment to add, which should be encoded by the
encode method.IOExceptionMalformedURLExceptionpublic URL getAlias()
public boolean exists()
exists in class URLResourcepublic long lastModified()
lastModified in class URLResourcepublic boolean isDirectory()
isDirectory in class URLResourcepublic long length()
length in class URLResourcepublic String getName()
getName in class URLResourcepublic File getFile()
getFile in class URLResourcepublic InputStream getInputStream() throws IOException
getInputStream in class URLResourceIOExceptionpublic ReadableByteChannel getReadableByteChannel() throws IOException
ResourcegetReadableByteChannel in class URLResourceIOExceptionpublic boolean delete()
throws SecurityException
delete in class URLResourceSecurityExceptionpublic boolean renameTo(Resource dest) throws SecurityException
renameTo in class URLResourceSecurityExceptionpublic String[] list()
list in class URLResourcepublic String encode(String uri)
public boolean equals(Object o)
equals in class URLResourceo - true of the object o is a FileResource pointing to the same file as this resource.public int hashCode()
hashCode in class URLResourcepublic void copyTo(File destination) throws IOException
copyTo in class ResourceIOExceptionCopyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.