handles.
Obviously supports resolution as File, and also as URL.
| Method from org.springframework.core.io.FileSystemResource Detail: |
public Resource createRelative(String relativePath) {
String pathToUse = StringUtils.applyRelativePath(this.path, relativePath);
return new FileSystemResource(pathToUse);
}
This implementation creates a FileSystemResource, applying the given path
relative to the path of the underlying file of this resource descriptor. |
public boolean equals(Object obj) {
return (obj == this ||
(obj instanceof FileSystemResource && this.path.equals(((FileSystemResource) obj).path)));
}
This implementation compares the underlying File references. |
public boolean exists() {
return this.file.exists();
}
This implementation returns whether the underlying file exists. |
public String getDescription() {
return "file [" + this.file.getAbsolutePath() + "]";
}
This implementation returns a description that includes the absolute
path of the file. |
public File getFile() {
return this.file;
}
This implementation returns the underlying File reference. |
public String getFilename() {
return this.file.getName();
}
This implementation returns the name of the file. |
public InputStream getInputStream() throws IOException {
return new FileInputStream(this.file);
}
This implementation opens a FileInputStream for the underlying file. |
public final String getPath() {
return this.path;
}
Return the file path for this resource. |
public URI getURI() throws IOException {
return this.file.toURI();
}
This implementation returns a URI for the underlying file. |
public URL getURL() throws IOException {
return this.file.toURI().toURL();
}
This implementation returns a URL for the underlying file. |
public int hashCode() {
return this.path.hashCode();
}
This implementation returns the hash code of the underlying File reference. |
public boolean isReadable() {
return (this.file.canRead() && !this.file.isDirectory());
}
This implementation checks whether the underlying file is marked as readable
(and corresponds to an actual file with content, not to a directory). |