tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Commons IO > Filters > Non Writable File Filter

Non Writable File Filter 

Apache Commons IO is a java library with simple IO utilities and filters. This requires the library commons-io-2.1.jar to be in classpath. The following example shows using CanWriteFileFilter.CANNOT_WRITE filter. It returns TRUE if the file is non writable.


File Name  :  
com/bethecoder/tutorials/commons_io/tests/filters/NonWritableFileFilter.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.commons_io.tests.filters;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.filefilter.CanWriteFileFilter;

public class NonWritableFileFilter {

  /**
   @param args
   @throws IOException 
   */
  public static void main(String[] args) {
    File directory = new File("C:/input");
    
    String[] files = directory.list(CanWriteFileFilter.CANNOT_WRITE);
     for (String file : files) {
         System.out.println(file);
     }
  }
}
   

It gives the following output,
readonly_file.txt


                    Print

   



Books Recommendation

 
 
bl  br