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

Readonly 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 CanReadFileFilter.READ_ONLY filter. It returns TRUE if the file is read-only.


File Name  :  
com/bethecoder/tutorials/commons_io/tests/filters/ReadOnlyFileFilter.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.CanReadFileFilter;

public class ReadOnlyFileFilter {

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

It gives the following output,
readonly_file.txt


                    Print

   



Books Recommendation

 
 
bl  br