public class FileResource extends Resource
__defaultUseCaches
Constructor and Description |
---|
FileResource(URI uri) |
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 |
close()
Release any temporary resources held by the resource.
|
void |
copyTo(File destination) |
boolean |
delete()
Deletes the given resource
|
boolean |
equals(Object o) |
boolean |
exists()
Returns true if the resource exists.
|
URI |
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.
|
URI |
getURI()
Returns an URI representing the given resource
|
URL |
getURL()
Returns an URL representing the given resource
|
int |
hashCode() |
boolean |
isContainedIn(Resource r) |
boolean |
isDirectory()
Returns true if the 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
|
String |
toString() |
encode, finalize, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getResource, getWeakETag, isContainedIn, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, release, setAssociate, setDefaultUseCaches, toURL, writeTo
public FileResource(URL url) throws IOException, URISyntaxException
IOException
URISyntaxException
public FileResource(URI uri)
public Resource addPath(String path) throws IOException, MalformedURLException
Resource
addPath
in class Resource
path
- The path segment to add, which is not encodedIOException
MalformedURLException
public URI getAlias()
public boolean exists()
public long lastModified()
lastModified
in class Resource
public boolean isDirectory()
isDirectory
in class Resource
public long length()
public String getName()
public File getFile()
public InputStream getInputStream() throws IOException
getInputStream
in class Resource
IOException
public ReadableByteChannel getReadableByteChannel() throws IOException
Resource
getReadableByteChannel
in class Resource
IOException
public boolean delete() throws SecurityException
delete
in class Resource
SecurityException
public boolean renameTo(Resource dest) throws SecurityException
renameTo
in class Resource
SecurityException
public String[] list()
public boolean equals(Object o)
equals
in class Object
o
- true
of the object o
is a FileResource
pointing to the same file as this resource.public void copyTo(File destination) throws IOException
copyTo
in class Resource
IOException
public boolean isContainedIn(Resource r) throws MalformedURLException
isContainedIn
in class Resource
MalformedURLException
public void close()
Resource
public URL getURL()
Resource
public URI getURI()
Resource
Copyright © 1995-2015 Webtide. All Rights Reserved.