Package org.apache.commons.vfs2.filter
Class SymbolicLinkFileFilter
java.lang.Object
org.apache.commons.vfs2.filter.SymbolicLinkFileFilter
- All Implemented Interfaces:
Serializable
,FileFilter
This filter accepts
File
s that are symbolic links.
Example, showing how to print out a list of the current directory's symbolic link files:
FileSystemManager fsManager = VFS.getManager(); FileObject dir = fsManager.toFileObject(new File(".")); FileObject[] files = dir.findFiles(new FileFilterSelector(SymbolicLinkFileFilter.SYMBOLIC)); for (int i = 0; i < files.length; i++) { System.out.println(files[i]); }
Example, showing how to print out a list of the current directory's actual (i.e. symbolic link) files:
FileSystemManager fsManager = VFS.getManager(); FileObject dir = fsManager.toFileObject(new File(".")); FileObject[] files = dir.findFiles(new FileFilterSelector(SymbolicLinkFileFilter.ACTUAL)); for (int i = 0; i < files.length; i++) { System.out.println(files[i]); }
- Since:
- 2.4
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FileFilter
Singleton instance of visible filter.static final FileFilter
Singleton instance of hidden filter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(FileSelectInfo fileSelectInfo) Checks to see if the file is a symbolic link.
-
Field Details
-
SYMBOLIC
Singleton instance of hidden filter. -
ACTUAL
Singleton instance of visible filter.
-
-
Constructor Details
-
SymbolicLinkFileFilter
protected SymbolicLinkFileFilter()Restrictive constructor.
-
-
Method Details
-
accept
Checks to see if the file is a symbolic link. Non-existing files won't be accepted.- Specified by:
accept
in interfaceFileFilter
- Parameters:
fileSelectInfo
- the file to check- Returns:
true
if the file is symbolic link, otherwisefalse
.- Throws:
FileSystemException
- Thrown for file system errors.
-