public class FileSystemResource extends Object
FileSystemResource represents a resource (i.e. file) in a
FileSystem.| Modifier and Type | Field and Description |
|---|---|
protected FileSystem |
fs |
protected String |
path |
| Constructor and Description |
|---|
FileSystemResource(FileSystem fs,
String path)
Creates a new
FileSystemResource |
| Modifier and Type | Method and Description |
|---|---|
void |
delete()
Deletes this resource.
|
void |
delete(boolean pruneEmptyParentDirs)
Deletes this resource.
|
boolean |
equals(Object obj) |
boolean |
exists() |
FileSystem |
getFileSystem()
Returns the
FileSystem where this resource is located. |
InputStream |
getInputStream() |
String |
getName()
Returns the name of this resource.
|
OutputStream |
getOutputStream() |
String |
getParentDir()
Returns the parent directory of this resource.
|
String |
getPath()
Returns the path of this resource.
|
int |
hashCode()
Returns zero to satisfy the Object equals/hashCode contract.
|
long |
lastModified() |
long |
length() |
void |
makeParentDirs()
Creates the parent directory of this resource, including any necessary
but nonexistent parent directories.
|
void |
spool(OutputStream out)
Spools this resource to the given output stream.
|
String |
toString()
Returns the path string of this resource.
|
protected final FileSystem fs
protected final String path
public FileSystemResource(FileSystem fs, String path)
FileSystemResourcefs - the FileSystem where the resource is locatedpath - the path of the resource in the FileSystempublic FileSystem getFileSystem()
FileSystem where this resource is located.FileSystem where this resource is located.public String getPath()
public String getParentDir()
public String getName()
public void makeParentDirs()
throws FileSystemException
FileSystemExceptionpublic void delete()
throws FileSystemException
delete(boolean) called with false.FileSystemExceptionFileSystem.deleteFile(java.lang.String)public void delete(boolean pruneEmptyParentDirs)
throws FileSystemException
pruneEmptyParentDirs - if true, empty parent folders will
automatically be deletedFileSystemExceptionFileSystem.deleteFile(java.lang.String)public boolean exists()
throws FileSystemException
FileSystemExceptionFileSystem.exists(java.lang.String)public InputStream getInputStream() throws FileSystemException
FileSystemExceptionFileSystem.getInputStream(java.lang.String)public void spool(OutputStream out) throws FileSystemException, IOException
out - output stream where to spool the resourceFileSystemException - if the input stream for this resource could
not be obtainedIOException - if an error occurs while while spoolingFileSystem.getInputStream(java.lang.String)public OutputStream getOutputStream() throws FileSystemException
FileSystemExceptionFileSystem.getOutputStream(java.lang.String)public long lastModified()
throws FileSystemException
FileSystemExceptionFileSystem.lastModified(java.lang.String)public long length()
throws FileSystemException
FileSystemExceptionFileSystem.length(java.lang.String)public String toString()
getPath() method.public int hashCode()
hashCode in class ObjectObject.hashCode()Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.