PathResource
@Deprecated public class FileResource extends Resource
Modifier and Type | Field and Description |
---|---|
private java.net.URI |
_alias
Deprecated.
|
private java.io.File |
_file
Deprecated.
|
private java.net.URI |
_uri
Deprecated.
|
private static Logger |
LOG
Deprecated.
|
__defaultUseCaches, _associate
Constructor and Description |
---|
FileResource(java.io.File file)
Deprecated.
|
FileResource(java.io.File base,
java.lang.String childPath)
Deprecated.
|
FileResource(java.net.URI uri)
Deprecated.
|
FileResource(java.net.URL url)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Resource |
addPath(java.lang.String path)
Deprecated.
Returns the resource contained inside the current resource with the
given name.
|
private void |
assertValidPath(java.lang.String path)
Deprecated.
|
private static java.net.URI |
checkFileAlias(java.net.URI uri,
java.io.File file)
Deprecated.
|
void |
close()
Deprecated.
Release any temporary resources held by the resource.
|
void |
copyTo(java.io.File destination)
Deprecated.
Copy the Resource to the new destination file.
|
boolean |
delete()
Deprecated.
Deletes the given resource
|
boolean |
equals(java.lang.Object o)
Deprecated.
|
boolean |
exists()
Deprecated.
Returns true if the resource exists.
|
java.net.URI |
getAlias()
Deprecated.
|
java.io.File |
getFile()
Deprecated.
Returns an File representing the given resource or NULL if this
is not possible.
|
java.io.InputStream |
getInputStream()
Deprecated.
Returns an input stream to the resource
|
java.lang.String |
getName()
Deprecated.
Returns the name of the resource
|
java.nio.channels.ReadableByteChannel |
getReadableByteChannel()
Deprecated.
Readable ByteChannel for the resource.
|
java.net.URI |
getURI()
Deprecated.
URI representing the resource.
|
java.net.URL |
getURL()
Deprecated.
URL representing the resource.
|
int |
hashCode()
Deprecated.
|
boolean |
isContainedIn(Resource r)
Deprecated.
|
boolean |
isDirectory()
Deprecated.
Returns true if the resource is a container/directory.
|
long |
lastModified()
Deprecated.
Returns the last modified time
|
long |
length()
Deprecated.
Return the length of the resource
|
java.lang.String[] |
list()
Deprecated.
Returns a list of resources contained in the given resource
|
private static java.net.URI |
normalizeURI(java.io.File file,
java.net.URI uri)
Deprecated.
|
boolean |
renameTo(Resource dest)
Deprecated.
Rename the given resource
|
java.lang.String |
toString()
Deprecated.
|
encode, finalize, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getListHTML, getResource, getWeakETag, getWeakETag, isAlias, isContainedIn, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, release, setAssociate, setDefaultUseCaches, toURL, writeTo
private static final Logger LOG
private final java.io.File _file
private final java.net.URI _uri
private final java.net.URI _alias
public FileResource(java.net.URL url) throws java.io.IOException, java.net.URISyntaxException
java.io.IOException
java.net.URISyntaxException
public FileResource(java.net.URI uri)
public FileResource(java.io.File file)
public FileResource(java.io.File base, java.lang.String childPath)
private static java.net.URI normalizeURI(java.io.File file, java.net.URI uri) throws java.net.URISyntaxException
java.net.URISyntaxException
private static java.net.URI checkFileAlias(java.net.URI uri, java.io.File file)
public Resource addPath(java.lang.String path) throws java.io.IOException
Resource
addPath
in class Resource
path
- 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.private void assertValidPath(java.lang.String path)
public java.net.URI getAlias()
public boolean exists()
public long lastModified()
lastModified
in class Resource
public boolean isDirectory()
isDirectory
in class Resource
public long length()
public java.lang.String getName()
public java.io.File getFile()
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in class Resource
java.io.IOException
- if unable to open the input streampublic java.nio.channels.ReadableByteChannel getReadableByteChannel() throws java.io.IOException
Resource
getReadableByteChannel
in class Resource
java.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 boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to compare against this instancetrue
of the object o
is a FileResource
pointing to the same file as this resource.public int hashCode()
hashCode
in class java.lang.Object
public void copyTo(java.io.File destination) throws java.io.IOException
Resource
Will not replace existing destination file.
public boolean isContainedIn(Resource r) throws java.net.MalformedURLException
isContainedIn
in class Resource
java.net.MalformedURLException
public void close()
Resource
public java.net.URL getURL()
Resource
public java.net.URI getURI()
Resource
public java.lang.String toString()
toString
in class java.lang.Object