? CanReadFileFilter
java.lang.Object
org.apache.commons.io.filefilter.AbstractFileFilter
org.apache.commons.io.filefilter.CanReadFileFilter
- ????????:
FileFilter
,FilenameFilter
,Serializable
,FileVisitor<Path>
,PathFilter
,PathVisitor
,IOFileFilter
This filter accepts
File
s that can be read.
Example, showing how to print out a list of the current directory's readable files:
Using Classic IO
File dir = new File("."); String[] files = dir.list(CanReadFileFilter.CAN_READ); for (String file : files) { System.out.println(file); }
Example, showing how to print out a list of the current directory's un-readable files:
File dir = new File("."); String[] files = dir.list(CanReadFileFilter.CANNOT_READ); for (String file : files) { System.out.println(file); }
Example, showing how to print out a list of the current directory's read-only files:
File dir = new File("."); String[] files = dir.list(CanReadFileFilter.READ_ONLY); for (String file : files) { System.out.println(file); }
- ???????:
- 1.3
- ????:
-
????
????????????static final IOFileFilter
Singleton instance of readable filterstatic final IOFileFilter
Singleton instance of not readable filterstatic final IOFileFilter
Singleton instance of read-only filter???????? org.apache.commons.io.filefilter.IOFileFilter
EMPTY_STRING_ARRAY
-
?????
??? -
????
??????????boolean
Checks to see if the file can be read.accept
(Path file, BasicFileAttributes attributes) Checks to see if the file can be read.??????? org.apache.commons.io.filefilter.AbstractFileFilter
accept, handle, postVisitDirectory, preVisitDirectory, toString, visitFile, visitFileFailed
??????? java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
???????? org.apache.commons.io.filefilter.IOFileFilter
and, negate, or
-
??????
-
CAN_READ
Singleton instance of readable filter -
CANNOT_READ
Singleton instance of not readable filter -
READ_ONLY
Singleton instance of read-only filter
-
-
???????
-
CanReadFileFilter
protected CanReadFileFilter()Restrictive constructor.
-
-
??????
-
accept
Checks to see if the file can be read.- ???:
accept
????FileFilter
- ???:
accept
????IOFileFilter
- ??:
accept
???AbstractFileFilter
- ??:
file
- the File to check.- ??:
true
if the file can be read, otherwisefalse
.
-
accept
Checks to see if the file can be read.- ???:
accept
????IOFileFilter
- ???:
accept
????PathFilter
- ??:
file
- the File to check.attributes
- the file's basic attributes (TODO may be null).- ??:
true
if the file can be read, otherwisefalse
.- ???????:
- 2.9.0
-