Class CanReadFileFilter

  • All Implemented Interfaces:
    java.io.Serializable, FileFilter

    public class CanReadFileFilter
    extends java.lang.Object
    implements FileFilter, java.io.Serializable
    This filter accepts Files that can be read.

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

     FileSystemManager fsManager = VFS.getManager();
     FileObject dir = fsManager.toFileObject(new File("."));
     FileObject[] files = dir.findFiles(new FileFilterSelector(CanReadFileFilter.CAN_READ));
     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-readable files:

     FileSystemManager fsManager = VFS.getManager();
     FileObject dir = fsManager.toFileObject(new File("."));
     FileObject[] files = dir.findFiles(new FileFilterSelector(CanReadFileFilter.CANNOT_READ));
     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 read-only files:

     FileSystemManager fsManager = VFS.getManager();
     FileObject dir = fsManager.toFileObject(new File("."));
     FileObject[] files = dir.findFiles(new FileFilterSelector(CanReadFileFilter.READ_ONLY));
     for (int i = 0; i < files.length; i++) {
         System.out.println(files[i]);
     }
     
    Since:
    2.4
    Author:
    This code was originally ported from Apache Commons IO File Filter
    See Also:
    "https://commons.apache.org/proper/commons-io/", Serialized Form
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected CanReadFileFilter()
      Restrictive constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(FileSelectInfo fileSelectInfo)
      Checks to see if the file can be read.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait