Package org.apache.jackrabbit.core.fs
Class FileSystemResource
- java.lang.Object
-
- org.apache.jackrabbit.core.fs.FileSystemResource
-
public class FileSystemResource extends java.lang.Object
AFileSystemResource
represents a resource (i.e. file) in aFileSystem
.
-
-
Constructor Summary
Constructors Constructor Description FileSystemResource(FileSystem fs, java.lang.String path)
Creates a newFileSystemResource
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
Deletes this resource.void
delete(boolean pruneEmptyParentDirs)
Deletes this resource.boolean
equals(java.lang.Object obj)
boolean
exists()
FileSystem
getFileSystem()
Returns theFileSystem
where this resource is located.java.io.InputStream
getInputStream()
java.lang.String
getName()
Returns the name of this resource.java.io.OutputStream
getOutputStream()
java.lang.String
getParentDir()
Returns the parent directory of this resource.java.lang.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(java.io.OutputStream out)
Spools this resource to the given output stream.java.lang.String
toString()
Returns the path string of this resource.
-
-
-
Constructor Detail
-
FileSystemResource
public FileSystemResource(FileSystem fs, java.lang.String path)
Creates a newFileSystemResource
- Parameters:
fs
- theFileSystem
where the resource is locatedpath
- the path of the resource in theFileSystem
-
-
Method Detail
-
getFileSystem
public FileSystem getFileSystem()
Returns theFileSystem
where this resource is located.- Returns:
- the
FileSystem
where this resource is located.
-
getPath
public java.lang.String getPath()
Returns the path of this resource.- Returns:
- the path of this resource.
-
getParentDir
public java.lang.String getParentDir()
Returns the parent directory of this resource.- Returns:
- the parent directory.
-
getName
public java.lang.String getName()
Returns the name of this resource.- Returns:
- the name.
-
makeParentDirs
public void makeParentDirs() throws FileSystemException
Creates the parent directory of this resource, including any necessary but nonexistent parent directories.- Throws:
FileSystemException
-
delete
public void delete() throws FileSystemException
Deletes this resource. Same asdelete(boolean)
called withfalse
.- Throws:
FileSystemException
- See Also:
FileSystem.deleteFile(java.lang.String)
-
delete
public void delete(boolean pruneEmptyParentDirs) throws FileSystemException
Deletes this resource.- Parameters:
pruneEmptyParentDirs
- iftrue
, empty parent folders will automatically be deleted- Throws:
FileSystemException
- See Also:
FileSystem.deleteFile(java.lang.String)
-
exists
public boolean exists() throws FileSystemException
- Throws:
FileSystemException
- See Also:
FileSystem.exists(java.lang.String)
-
getInputStream
public java.io.InputStream getInputStream() throws FileSystemException
- Throws:
FileSystemException
- See Also:
FileSystem.getInputStream(java.lang.String)
-
spool
public void spool(java.io.OutputStream out) throws FileSystemException, java.io.IOException
Spools this resource to the given output stream.- Parameters:
out
- output stream where to spool the resource- Throws:
FileSystemException
- if the input stream for this resource could not be obtainedjava.io.IOException
- if an error occurs while while spooling- See Also:
FileSystem.getInputStream(java.lang.String)
-
getOutputStream
public java.io.OutputStream getOutputStream() throws FileSystemException
- Throws:
FileSystemException
- See Also:
FileSystem.getOutputStream(java.lang.String)
-
lastModified
public long lastModified() throws FileSystemException
- Throws:
FileSystemException
- See Also:
FileSystem.lastModified(java.lang.String)
-
length
public long length() throws FileSystemException
- Throws:
FileSystemException
- See Also:
FileSystem.length(java.lang.String)
-
toString
public java.lang.String toString()
Returns the path string of this resource. This is just the string returned by the
method.getPath()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- The path string of this resource
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Returns zero to satisfy the Object equals/hashCode contract. This class is mutable and not meant to be used as a hash key.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- always zero
- See Also:
Object.hashCode()
-
-