|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.core.io.AbstractResource org.springframework.core.io.FileSystemResource
public class FileSystemResource
Resource implementation for java.io.File handles. Obviously supports resolution as File, and also as URL.
File
Constructor Summary | |
---|---|
FileSystemResource(File file)
Create a new FileSystemResource. |
|
FileSystemResource(String path)
Create a new FileSystemResource. |
Method Summary | |
---|---|
Resource |
createRelative(String relativePath)
This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource. |
boolean |
equals(Object obj)
This implementation compares description strings. |
boolean |
exists()
This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened. |
String |
getDescription()
This abstract method declaration shadows the method in the Resource interface. |
File |
getFile()
This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path. |
String |
getFilename()
This implementation always throws IllegalStateException, assuming that the resource does not carry a filename. |
InputStream |
getInputStream()
Return an InputStream. |
URL |
getURL()
This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL. |
int |
hashCode()
This implementation returns the description's hash code. |
Methods inherited from class org.springframework.core.io.AbstractResource |
---|
isOpen, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileSystemResource(File file)
file
- a File handlepublic FileSystemResource(String path)
path
- a file pathMethod Detail |
---|
public boolean exists()
AbstractResource
exists
in interface Resource
exists
in class AbstractResource
public InputStream getInputStream() throws IOException
InputStreamSource
IOException
- if the stream could not be openedpublic URL getURL() throws IOException
AbstractResource
getURL
in interface Resource
getURL
in class AbstractResource
IOException
- if the resource cannot be resolved as URL,
i.e. if the resource is not available as descriptorpublic File getFile()
AbstractResource
getFile
in interface Resource
getFile
in class AbstractResource
public Resource createRelative(String relativePath)
AbstractResource
createRelative
in interface Resource
createRelative
in class AbstractResource
relativePath
- the relative path (relative to this resource)
public String getFilename()
AbstractResource
getFilename
in interface Resource
getFilename
in class AbstractResource
public String getDescription()
AbstractResource
toString
implementation in this
class work on Sun's JDK 1.3 classic VM, which can't find the
getDescription
method when executing toString
else.
getDescription
in interface Resource
getDescription
in class AbstractResource
Resource.getDescription()
public boolean equals(Object obj)
AbstractResource
equals
in class AbstractResource
AbstractResource.getDescription()
public int hashCode()
AbstractResource
hashCode
in class AbstractResource
AbstractResource.getDescription()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |