FileDocCategorySizeDatePackage
CanWriteFileFilter.javaAPI DocAndroid 1.5 API2597Wed May 06 22:42:46 BST 2009org.apache.commons.io.filefilter

CanWriteFileFilter

public class CanWriteFileFilter extends AbstractFileFilter implements Serializable
This filter accepts Files that can be written to.

Example, showing how to print out a list of the current directory's writable files:

File dir = new File(".");
String[] files = dir.list( CanWriteFileFilter.CAN_WRITE );
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 un-writable files:

File dir = new File(".");
String[] files = dir.list( CanWriteFileFilter.CANNOT_WRITE );
for ( int i = 0; i < files.length; i++ ) {
System.out.println(files[i]);
}

N.B. For read-only files, use CanReadFileFilter.READ_ONLY.

since
Commons IO 1.3
version
$Revision: 587916 $

Fields Summary
public static final IOFileFilter
CAN_WRITE
Singleton instance of writable filter
public static final IOFileFilter
CANNOT_WRITE
Singleton instance of not writable filter
Constructors Summary
protected CanWriteFileFilter()
Restrictive consructor.


           
      
    
Methods Summary
public booleanaccept(java.io.File file)
Checks to see if the file can be written to.

param
file the File to check
return
true if the file can be written to, otherwise false.

        return file.canWrite();