public class DirectoryFileFilter extends AbstractFileFilter implements Serializable
File
s that are directories.
For example, here is how to print out a list of the current directory's subdirectories:
File dir = new File("."); String[] files = dir.list( DirectoryFileFilter.INSTANCE ); for ( int i = 0; i < files.length; i++ ) { System.out.println(files[i]); }
FileFilterUtils.directoryFileFilter()
,
Serialized FormModifier and Type | Field and Description |
---|---|
static IOFileFilter |
DIRECTORY
Singleton instance of directory filter.
|
static IOFileFilter |
INSTANCE
Singleton instance of directory filter.
|
Modifier | Constructor and Description |
---|---|
protected |
DirectoryFileFilter()
Restrictive consructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(File file)
Checks to see if the file is a directory.
|
accept, toString
public static final IOFileFilter DIRECTORY
public static final IOFileFilter INSTANCE
public boolean accept(File file)
accept
in interface IOFileFilter
accept
in interface FileFilter
accept
in class AbstractFileFilter
file
- the File to checkCopyright © 2001–2019 KnowGate. All rights reserved.