Package org.apache.commons.vfs2.cache
Class OnCallRefreshFileObject
java.lang.Object
org.apache.commons.vfs2.impl.DecoratedFileObject
org.apache.commons.vfs2.cache.OnCallRefreshFileObject
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Comparable<FileObject>,- Iterable<FileObject>,- FileObject
This decorator refreshes the fileObject data on every call.
- 
Field SummaryFields inherited from interface org.apache.commons.vfs2.FileObjectEMPTY_ARRAY
- 
Constructor SummaryConstructorsConstructorDescriptionOnCallRefreshFileObject(FileObject fileObject) Constructs a new instance to decorate the given file object.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes this file, and its content.voidcopyFrom(FileObject srcFile, FileSelector selector) Copies another file, and all its descendants, to this file.voidCreates this file, if it does not exist.voidCreates this folder, if it does not exist.booleandelete()Deletes this file.intdelete(FileSelector selector) Deletes all descendants of this file that match a selector.booleanexists()Determines if this file exists.findFiles(FileSelector selector) Finds the set of matching descendants of this file, in depthwise order.voidfindFiles(FileSelector selector, boolean depthwise, List<FileObject> selected) Finds the set of matching descendants of this file.Gets a child of this file.Gets a lists of children of this file.Gets this file's content.getType()Gets this file's type.booleanDetermines if this file is executable.booleanisHidden()Determines if this file is hidden.booleanDetermines if this file can be read.booleanDetermines if this file can be written to.voidmoveTo(FileObject destFile) Move this file.resolveFile(String path) Finds a file, relative to this file.resolveFile(String name, NameScope scope) Finds a file relative to this file.booleansetExecutable(boolean executable, boolean ownerOnly) Sets the owner's (or everybody's) write permission.booleansetReadable(boolean readable, boolean ownerOnly) Sets the owner's (or everybody's) read permission.booleansetWritable(boolean writable, boolean ownerOnly) Sets the owner's (or everybody's) write permission.Methods inherited from class org.apache.commons.vfs2.impl.DecoratedFileObjectcanRenameTo, compareTo, deleteAll, getDecoratedFileObject, getFileOperations, getFileSystem, getName, getParent, getPublicURIString, getURL, isAttached, isContentOpen, isFile, isFolder, iterator, refresh, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.vfs2.FileObjectgetPath, getURI, isSymbolicLinkMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
OnCallRefreshFileObjectConstructs a new instance to decorate the given file object.- Parameters:
- fileObject- The decorated.
 
 
- 
- 
Method Details- 
closeDescription copied from interface:FileObjectCloses this file, and its content. This method is a hint to the implementation that it can release any resources associated with the file.The file object can continue to be used after this method is called. - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein interface- FileObject
- Overrides:
- closein class- DecoratedFileObject
- Throws:
- FileSystemException- On error closing the file.
- See Also:
 
- 
copyFromDescription copied from interface:FileObjectCopies another file, and all its descendants, to this file.If this file does not exist, it is created. Its parent folder is also created, if necessary. If this file does exist, it is deleted first. This method is not transactional. If it fails and throws an exception, this file will potentially only be partially copied. - Specified by:
- copyFromin interface- FileObject
- Overrides:
- copyFromin class- DecoratedFileObject
- Parameters:
- srcFile- The source file to copy.
- selector- The selector to use to select which files to copy.
- Throws:
- FileSystemException- If this file is read-only, or if the source file does not exist, or on error copying the file.
 
- 
createFileDescription copied from interface:FileObjectCreates this file, if it does not exist. Also creates any ancestor folders which do not exist. This method does nothing if the file already exists and is a file.- Specified by:
- createFilein interface- FileObject
- Overrides:
- createFilein class- DecoratedFileObject
- Throws:
- 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.
 
- 
createFolderDescription copied from interface:FileObjectCreates this folder, if it does not exist. Also creates any ancestor folders which do not exist. This method does nothing if the folder already exists.- Specified by:
- createFolderin interface- FileObject
- Overrides:
- createFolderin class- DecoratedFileObject
- Throws:
- 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.
 
- 
deleteDescription copied from interface:FileObjectDeletes this file. Does nothing if this file does not exist of if it is a folder that has children. Does not delete any descendants of this file, useFileObject.delete(FileSelector)orFileObject.deleteAll()for that.- Specified by:
- deletein interface- FileObject
- Overrides:
- deletein class- DecoratedFileObject
- Returns:
- true if this object has been deleted
- Throws:
- FileSystemException- If this file is a non-empty folder, or if this file is read-only, or on error deleteing this file.
 
- 
deleteDescription copied from interface:FileObjectDeletes all descendants of this file that match a selector. Does nothing if this file does not exist.This method is not transactional. If it fails and throws an exception, this file will potentially only be partially deleted. - Specified by:
- deletein interface- FileObject
- Overrides:
- deletein class- DecoratedFileObject
- Parameters:
- selector- The selector to use to select which files to delete.
- Returns:
- the number of deleted objects
- Throws:
- FileSystemException- If this file or one of its descendants is read-only, or on error deleting this file or one of its descendants.
 
- 
existsDescription copied from interface:FileObjectDetermines if this file exists.- Specified by:
- existsin interface- FileObject
- Overrides:
- existsin class- DecoratedFileObject
- Returns:
- trueif this file exists,- falseif not.
- Throws:
- FileSystemException- On error determining if this file exists.
 
- 
findFilesDescription copied from interface:FileObjectFinds the set of matching descendants of this file, in depthwise order.- Specified by:
- findFilesin interface- FileObject
- Overrides:
- findFilesin class- DecoratedFileObject
- Parameters:
- selector- The selector to use to select matching files.
- Returns:
- The matching files. The files are returned in depthwise order (that is, a child appears in the list before its parent).
- Throws:
- FileSystemException- if an error occurs.
 
- 
findFilespublic void findFiles(FileSelector selector, boolean depthwise, List<FileObject> selected) throws FileSystemException Description copied from interface:FileObjectFinds the set of matching descendants of this file.- Specified by:
- findFilesin interface- FileObject
- Overrides:
- findFilesin class- DecoratedFileObject
- Parameters:
- selector- the selector used to determine if the file should be selected
- depthwise- controls the ordering in the list. e.g. deepest first
- selected- container for selected files. list needs not to be empty.
- Throws:
- FileSystemException- if an error occurs.
 
- 
getChildDescription copied from interface:FileObjectGets a child of this file. Note that this method returnsnullwhen the child does not exist. This differs fromFileObject.resolveFile(String, NameScope)which never returns null.- Specified by:
- getChildin interface- FileObject
- Overrides:
- getChildin class- DecoratedFileObject
- Parameters:
- name- The name of the child.
- Returns:
- The child, or null if there is no such child.
- Throws:
- FileSystemException- If this file does not exist, or is not a folder, or on error determining this file's children.
 
- 
getChildrenDescription copied from interface:FileObjectGets a lists of children of this file.- Specified by:
- getChildrenin interface- FileObject
- Overrides:
- getChildrenin class- DecoratedFileObject
- Returns:
- An array containing the children of this file. The array is unordered. If the file does not have any children, a zero-length array is returned. This method never returns null.
- Throws:
- FileSystemException- If this file does not exist, or is not a folder, or on error listing this file's children.
 
- 
getContentDescription copied from interface:FileObjectGets this file's content. TheFileContentreturned 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 FileContentcan be used to create the file by writing its content.- Specified by:
- getContentin interface- FileObject
- Overrides:
- getContentin class- DecoratedFileObject
- Returns:
- This file's content.
- Throws:
- FileSystemException- On error getting this file's content.
 
- 
getTypeDescription copied from interface:FileObjectGets this file's type.- Specified by:
- getTypein interface- FileObject
- Overrides:
- getTypein class- DecoratedFileObject
- Returns:
- One of the FileTypeconstants. Never returns null.
- Throws:
- FileSystemException- On error determining the file's type.
 
- 
isExecutableDescription copied from interface:FileObjectDetermines if this file is executable.- Specified by:
- isExecutablein interface- FileObject
- Overrides:
- isExecutablein class- DecoratedFileObject
- Returns:
- trueif this file is executable,- falseif not.
- Throws:
- FileSystemException- On error determining if this file exists.
 
- 
isHiddenDescription copied from interface:FileObjectDetermines if this file is hidden.- Specified by:
- isHiddenin interface- FileObject
- Overrides:
- isHiddenin class- DecoratedFileObject
- Returns:
- trueif this file is hidden,- falseif not.
- Throws:
- FileSystemException- On error determining if this file exists.
 
- 
isReadableDescription copied from interface:FileObjectDetermines if this file can be read.- Specified by:
- isReadablein interface- FileObject
- Overrides:
- isReadablein class- DecoratedFileObject
- Returns:
- trueif this file is readable,- falseif not.
- Throws:
- FileSystemException- On error determining if this file exists.
 
- 
isWriteableDescription copied from interface:FileObjectDetermines if this file can be written to.- Specified by:
- isWriteablein interface- FileObject
- Overrides:
- isWriteablein class- DecoratedFileObject
- Returns:
- trueif this file is writable,- falseif not.
- Throws:
- FileSystemException- On error determining if this file exists.
 
- 
moveToDescription copied from interface:FileObjectMove this file.If the destFile exists, it is deleted first. - Specified by:
- moveToin interface- FileObject
- Overrides:
- moveToin class- DecoratedFileObject
- Parameters:
- destFile- the New file name.
- Throws:
- FileSystemException- If this file is read-only, or if the source file does not exist, or on error copying the file.
 
- 
resolveFileDescription copied from interface:FileObjectFinds a file, relative to this file. Equivalent to callingresolveFile( path, NameScope.FILE_SYSTEM ).- Specified by:
- resolveFilein interface- FileObject
- Overrides:
- resolveFilein class- DecoratedFileObject
- Parameters:
- path- The path of the file to locate. Can either be a relative path or an absolute path.
- Returns:
- The file.
- Throws:
- FileSystemException- On error parsing the path, or on error finding the file.
 
- 
resolveFileDescription copied from interface:FileObjectFinds a file relative to this file. Refer toNameScopefor a description of how names are resolved in the different scopes.- Specified by:
- resolveFilein interface- FileObject
- Overrides:
- resolveFilein class- DecoratedFileObject
- Parameters:
- name- The name to resolve.
- scope- the NameScope for the file.
- Returns:
- The file.
- Throws:
- FileSystemException- On error parsing the path, or on error finding the file.
 
- 
setExecutableDescription copied from interface:FileObjectSets the owner's (or everybody's) write permission.- Specified by:
- setExecutablein interface- FileObject
- Overrides:
- setExecutablein class- DecoratedFileObject
- Parameters:
- executable- True to allow read access, false to disallow.
- ownerOnly- If- true, the permission applies only to the owner; otherwise, it applies to everybody.
- Returns:
- true if the operation succeeded.
- Throws:
- FileSystemException- On error determining if this file exists.
 
- 
setReadableDescription copied from interface:FileObjectSets the owner's (or everybody's) read permission.- Specified by:
- setReadablein interface- FileObject
- Overrides:
- setReadablein class- DecoratedFileObject
- Parameters:
- readable- True to allow read access, false to disallow
- ownerOnly- If- true, the permission applies only to the owner; otherwise, it applies to everybody.
- Returns:
- true if the operation succeeded
- Throws:
- FileSystemException- On error determining if this file exists.
 
- 
setWritableDescription copied from interface:FileObjectSets the owner's (or everybody's) write permission.- Specified by:
- setWritablein interface- FileObject
- Overrides:
- setWritablein class- DecoratedFileObject
- Parameters:
- writable- True to allow read access, false to disallow
- ownerOnly- If- true, the permission applies only to the owner; otherwise, it applies to everybody.
- Returns:
- true if the operation succeeded
- Throws:
- FileSystemException- On error determining if this file exists.
 
 
-