|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jackrabbit.core.fs.BasedFileSystem
A BasedFileSystem
represents a 'file system in a file system'.
Field Summary | |
protected String |
basePath
|
protected FileSystem |
fsBase
|
Fields inherited from interface org.apache.jackrabbit.core.fs.FileSystem |
SEPARATOR, SEPARATOR_CHAR |
Constructor Summary | |
BasedFileSystem(FileSystem fsBase,
String relRootPath)
Creates a new BasedFileSystem |
Method Summary | |
protected String |
buildBasePath(String path)
|
void |
close()
Close the file system. After calling this method, the file system is no longer accessible. |
void |
copy(String srcPath,
String destPath)
Copies a file or folder to a new location. |
void |
createFolder(String folderPath)
Creates the folder named by this path, including any necessary but nonexistent parent folders. Note that if this operation fails it may have succeeded in creating some of the necessary parent folders. |
void |
deleteFile(String filePath)
Deletes the file denoted by this path. |
void |
deleteFolder(String folderPath)
Deletes the folder denoted by this path. Any contents of this folder (folders and files) will be deleted recursively. |
boolean |
exists(String path)
Tests whether the file system entry denoted by this path exists. |
InputStream |
getInputStream(String filePath)
Returns an input stream of the contents of the file denoted by this path. |
OutputStream |
getOutputStream(String filePath)
Returns an output stream for writing bytes to the file denoted by this path. The file will be created if it doesn't exist. If the file exists, its contents will be overwritten. |
RandomAccessOutputStream |
getRandomAccessOutputStream(String filePath)
Returns an output stream for writing bytes to the file denoted by this path. The file will be created if it doesn't exist. The current position of the file pointer is set to 0 . See also
RandomAccessOutputStream.seek(long) ; |
boolean |
hasChildren(String path)
Tests whether the file system entry denoted by this path has child entries. |
void |
init()
Initialize the file system |
boolean |
isFile(String path)
Tests whether the file system entry denoted by this path is a file. |
boolean |
isFolder(String path)
Tests whether the file system entry denoted by this path is a folder. |
long |
lastModified(String path)
Returns the time that the file system entry denoted by this path was last modified. |
long |
length(String filePath)
Returns the length of the file denoted by this path. |
String[] |
list(String folderPath)
Returns an array of strings naming the files and folders in the folder denoted by this path. |
String[] |
listFiles(String folderPath)
Returns an array of strings naming the files in the folder denoted by this path. |
String[] |
listFolders(String folderPath)
Returns an array of strings naming the folders in the folder denoted by this path. |
void |
move(String srcPath,
String destPath)
Moves a file or folder to a new location. |
void |
touch(String filePath)
Set the modified time of an existing file to now. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final FileSystem fsBase
protected final String basePath
Constructor Detail |
public BasedFileSystem(FileSystem fsBase, String relRootPath)
BasedFileSystem
fsBase
- the FileSystem
the new file system should be based onrelRootPath
- the root path relative to fsBase
's rootMethod Detail |
protected String buildBasePath(String path)
public void init() throws FileSystemException
init
in interface FileSystem
FileSystemException
- if the file system initialization failspublic void close() throws FileSystemException
close
in interface FileSystem
FileSystemException
public void copy(String srcPath, String destPath) throws FileSystemException
copy
in interface FileSystem
srcPath
- the path of the file or folder to be copied.destPath
- the destination path to which the file or folder is to be copied.
FileSystemException
- if the copy failspublic void createFolder(String folderPath) throws FileSystemException
createFolder
in interface FileSystem
folderPath
- the path of the folder to be created.
FileSystemException
- if a file system entry denoted by path
already exists or if another error occurs.public void deleteFile(String filePath) throws FileSystemException
deleteFile
in interface FileSystem
filePath
- the path of the file to be deleted.
FileSystemException
- if this path does not denote a file or if
another error occurs.public void deleteFolder(String folderPath) throws FileSystemException
deleteFolder
in interface FileSystem
folderPath
- the path of the folder to be deleted.
FileSystemException
- if this path does not denote a folder or if
another error occurs.public boolean exists(String path) throws FileSystemException
exists
in interface FileSystem
path
- the path of a file system entry.
FileSystemException
public InputStream getInputStream(String filePath) throws FileSystemException
getInputStream
in interface FileSystem
filePath
- the path of the file.
FileSystemException
- if the file does not exist
or if it cannot be read frompublic OutputStream getOutputStream(String filePath) throws FileSystemException
getOutputStream
in interface FileSystem
filePath
- the path of the file.
FileSystemException
- if the file cannot be written to or createdpublic RandomAccessOutputStream getRandomAccessOutputStream(String filePath) throws FileSystemException
0
. See also
RandomAccessOutputStream.seek(long)
;
getRandomAccessOutputStream
in interface FileSystem
filePath
- the path of the file.
FileSystemException
- if the file could not be created or
if the output stream cannot be obtained.public boolean hasChildren(String path) throws FileSystemException
hasChildren
in interface FileSystem
path
- the path of a file system entry.
FileSystemException
public boolean isFile(String path) throws FileSystemException
isFile
in interface FileSystem
path
- the path of a file system entry.
FileSystemException
public boolean isFolder(String path) throws FileSystemException
isFolder
in interface FileSystem
path
- the path of a file system entry.
FileSystemException
public long lastModified(String path) throws FileSystemException
lastModified
in interface FileSystem
path
- the path of a file system entry.
FileSystemException
- if the file system entry does not exist.public long length(String filePath) throws FileSystemException
length
in interface FileSystem
filePath
- the path of the file.
FileSystemException
- if the path does not denote an existing file.public void touch(String filePath) throws FileSystemException
touch
in interface FileSystem
filePath
- the path of the file.
FileSystemException
- if the path does not denote an existing file.public String[] list(String folderPath) throws FileSystemException
list
in interface FileSystem
folderPath
- the path of the folder whose contents is to be listed.
FileSystemException
- if this path does not denote a folder or if
another error occurs.public String[] listFiles(String folderPath) throws FileSystemException
listFiles
in interface FileSystem
folderPath
- the path of the folder whose contents is to be listed.
FileSystemException
- if this path does not denote a folder or if
another error occurs.public String[] listFolders(String folderPath) throws FileSystemException
listFolders
in interface FileSystem
folderPath
- the path of the folder whose contents is to be listed.
FileSystemException
- if this path does not denote a folder or if
another error occurs.public void move(String srcPath, String destPath) throws FileSystemException
move
in interface FileSystem
srcPath
- the path of the file or folder to be moved.destPath
- the destination path to which the file or folder is to be moved.
FileSystemException
- if the move fails
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |