|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.vfs.impl.DecoratedFileObject
Base class to build a fileObject decoration
Constructor Summary | |
DecoratedFileObject(FileObject decoratedFileObject)
|
Method Summary | |
boolean |
canRenameTo(FileObject newfile)
Queries the file if it is possible to rename it to newfile. |
void |
close()
Closes this file, and its content. |
void |
copyFrom(FileObject srcFile,
FileSelector selector)
Copies another file, and all its descendents, to this file. |
void |
createFile()
Creates this file, if it does not exist. |
void |
createFolder()
Creates this folder, if it does not exist. |
boolean |
delete()
Deletes this file. |
int |
delete(FileSelector selector)
Deletes all descendents of this file that match a selector. |
boolean |
exists()
Determines if this file exists. |
FileObject[] |
findFiles(FileSelector selector)
Finds the set of matching descendents of this file, in depthwise order. |
void |
findFiles(FileSelector selector,
boolean depthwise,
List selected)
Finds the set of matching descendents of this file. |
FileObject |
getChild(String name)
Returns a child of this file. |
FileObject[] |
getChildren()
Lists the children of this file. |
FileContent |
getContent()
Returns this file's content. |
FileObject |
getDecoratedFileObject()
|
FileOperations |
getFileOperations()
|
FileSystem |
getFileSystem()
Returns the file system that contains this file. |
FileName |
getName()
Returns the name of this file. |
FileObject |
getParent()
Returns the folder that contains this file. |
FileType |
getType()
Returns this file's type. |
URL |
getURL()
Returns a URL representing this file. |
boolean |
isAttached()
check if the fileObject is attaced |
boolean |
isContentOpen()
check if someone reads/write to this file |
boolean |
isHidden()
Determines if this file is hidden. |
boolean |
isReadable()
Determines if this file can be read. |
boolean |
isWriteable()
Determines if this file can be written to. |
void |
moveTo(FileObject destFile)
Move this file. |
void |
refresh()
This will prepare the fileObject to get resynchronized with the underlaying filesystem if required |
FileObject |
resolveFile(String path)
Finds a file, relative to this file. |
FileObject |
resolveFile(String name,
NameScope scope)
Finds a file, relative to this file. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DecoratedFileObject(FileObject decoratedFileObject)
Method Detail |
public boolean canRenameTo(FileObject newfile)
FileObject
canRenameTo
in interface FileObject
newfile
- the new file(-name)
public void close() throws FileSystemException
FileObject
The file object can continue to be used after this method is called.
close
in interface FileObject
FileSystemException
- On error closing the file.FileContent.close()
public void copyFrom(FileObject srcFile, FileSelector selector) throws FileSystemException
FileObject
This method is not transactional. If it fails and throws an exception, this file will potentially only be partially copied.
copyFrom
in interface FileObject
srcFile
- The source file to copy.selector
- The selector to use to select which files to copy.
FileSystemException
- If this file is read-only, or if the source file does not exist,
or on error copying the file.public void createFile() throws FileSystemException
FileObject
createFile
in interface FileObject
FileSystemException
- If the file already exists with the wrong type, or the parent
folder is read-only, or on error creating this file or one of
its ancestors.public void createFolder() throws FileSystemException
FileObject
createFolder
in interface FileObject
FileSystemException
- If the folder already exists with the wrong type, or the parent
folder is read-only, or on error creating this folder or one of
its ancestors.public boolean delete() throws FileSystemException
FileObject
FileObject.delete(FileSelector)
for that.
delete
in interface FileObject
FileSystemException
- If this file is a non-empty folder, or if this file is read-only,
or on error deleteing this file.public int delete(FileSelector selector) throws FileSystemException
FileObject
This method is not transactional. If it fails and throws an exception, this file will potentially only be partially deleted.
delete
in interface FileObject
selector
- The selector to use to select which files to delete.
FileSystemException
- If this file or one of its descendents is read-only, or on error
deleting this file or one of its descendents.public boolean exists() throws FileSystemException
FileObject
exists
in interface FileObject
true
if this file exists, false
if not.
FileSystemException
- On error determining if this file exists.public void findFiles(FileSelector selector, boolean depthwise, List selected) throws FileSystemException
FileObject
findFiles
in interface FileObject
selector
- the selector used to determine if the file should be selecteddepthwise
- controls the ordering in the list. e.g. deepest firstselected
- container for selected files. list needs not to be empty.
FileSystemException
public FileObject[] findFiles(FileSelector selector) throws FileSystemException
FileObject
findFiles
in interface FileObject
selector
- The selector to use to select matching files.
FileSystemException
public FileObject getChild(String name) throws FileSystemException
FileObject
null
when the child does not exist. This differs from
FileObject.resolveFile( String, NameScope)
which never returns null.
getChild
in interface FileObject
name
- The name of the child.
FileSystemException
- If this file does not exist, or is not a folder, or on error
determining this file's children.public FileObject[] getChildren() throws FileSystemException
FileObject
getChildren
in interface FileObject
FileSystemException
- If this file does not exist, or is not a folder, or on error
listing this file's children.public FileContent getContent() throws FileSystemException
FileObject
FileContent
returned by this
method can be used to read and write the content of the file.
This method can be called if the file does not exist, and
the returned FileContent
can be used to create the file
by writing its content.
getContent
in interface FileObject
FileSystemException
- On error getting this file's content.public FileSystem getFileSystem()
FileObject
getFileSystem
in interface FileObject
public FileName getName()
FileObject
getName
in interface FileObject
public FileObject getParent() throws FileSystemException
FileObject
getParent
in interface FileObject
FileSystemException
- On error finding the file's parent.public FileType getType() throws FileSystemException
FileObject
getType
in interface FileObject
FileType
constants. Never returns null.
FileSystemException
- On error determining the file's type.public URL getURL() throws FileSystemException
FileObject
getURL
in interface FileObject
FileSystemException
public boolean isHidden() throws FileSystemException
FileObject
isHidden
in interface FileObject
true
if this file is hidden, false
if not.
FileSystemException
- On error determining if this file exists.public boolean isReadable() throws FileSystemException
FileObject
isReadable
in interface FileObject
true
if this file is readable, false
if not.
FileSystemException
- On error determining if this file exists.public boolean isWriteable() throws FileSystemException
FileObject
isWriteable
in interface FileObject
true
if this file is writeable, false
if not.
FileSystemException
- On error determining if this file exists.public void moveTo(FileObject destFile) throws FileSystemException
FileObject
If the destFile exists, it is deleted first
moveTo
in interface FileObject
destFile
- the New filename.
FileSystemException
- If this file is read-only, or if the source file does not exist,
or on error copying the file.public FileObject resolveFile(String name, NameScope scope) throws FileSystemException
FileObject
NameScope
for a description of how names are resolved in the different scopes.
resolveFile
in interface FileObject
name
- The name to resolve.
FileSystemException
- On error parsing the path, or on error finding the file.public FileObject resolveFile(String path) throws FileSystemException
FileObject
resolveFile( path, NameScope.FILE_SYSTEM )
.
resolveFile
in interface FileObject
path
- The path of the file to locate. Can either be a relative
path or an absolute path.
FileSystemException
- On error parsing the path, or on error finding the file.public void refresh() throws FileSystemException
FileObject
refresh
in interface FileObject
FileSystemException
public FileObject getDecoratedFileObject()
public boolean isAttached()
FileObject
isAttached
in interface FileObject
public boolean isContentOpen()
FileObject
isContentOpen
in interface FileObject
public String toString()
public FileOperations getFileOperations() throws FileSystemException
getFileOperations
in interface FileObject
FileSystemException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |