Class FilesystemFilter

  • All Implemented Interfaces:
    java.io.FilenameFilter

    public class FilesystemFilter
    extends javax.swing.filechooser.FileFilter
    implements java.io.FilenameFilter
    A filesystem filter.
    Author:
    David Gilbert
    • Constructor Summary

      Constructors 
      Constructor Description
      FilesystemFilter​(java.lang.String[] fileext, java.lang.String descr, boolean accDirs)
      Creates a new filter.
      FilesystemFilter​(java.lang.String fileext, java.lang.String descr)
      Creates a new filter.
      FilesystemFilter​(java.lang.String fileext, java.lang.String descr, boolean accDirs)
      Creates a new filter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.io.File dir)
      Returns true if the specified file matches the requirements of this filter, and false otherwise.
      boolean accept​(java.io.File dir, java.lang.String name)
      Returns true if the file is accepted, and false otherwise.
      void acceptDirectories​(boolean b)
      Sets the flag that controls whether or not the filter accepts directories.
      boolean acceptsDirectories()
      Returns the flag that indicates whether or not the filter accepts directories.
      boolean equals​(java.lang.Object o)  
      java.lang.String getDescription()
      Returns the filter description.
      int hashCode()  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FilesystemFilter

        public FilesystemFilter​(java.lang.String fileext,
                                java.lang.String descr)
        Creates a new filter.
        Parameters:
        fileext - the file extension.
        descr - the description.
      • FilesystemFilter

        public FilesystemFilter​(java.lang.String fileext,
                                java.lang.String descr,
                                boolean accDirs)
        Creates a new filter.
        Parameters:
        fileext - the file extension.
        descr - the description.
        accDirs - accept directories?
      • FilesystemFilter

        public FilesystemFilter​(java.lang.String[] fileext,
                                java.lang.String descr,
                                boolean accDirs)
        Creates a new filter.
        Parameters:
        fileext - the file extension.
        descr - the description.
        accDirs - accept directories?
        Throws:
        java.lang.NullPointerException - if the file extensions are null.
    • Method Detail

      • accept

        public boolean accept​(java.io.File dir,
                              java.lang.String name)
        Returns true if the file is accepted, and false otherwise.
        Specified by:
        accept in interface java.io.FilenameFilter
        Parameters:
        dir - the directory.
        name - the file name.
        Returns:
        A boolean.
      • accept

        public boolean accept​(java.io.File dir)
        Returns true if the specified file matches the requirements of this filter, and false otherwise.
        Specified by:
        accept in class javax.swing.filechooser.FileFilter
        Parameters:
        dir - the file or directory.
        Returns:
        A boolean.
      • getDescription

        public java.lang.String getDescription()
        Returns the filter description.
        Specified by:
        getDescription in class javax.swing.filechooser.FileFilter
        Returns:
        The filter description.
      • acceptDirectories

        public void acceptDirectories​(boolean b)
        Sets the flag that controls whether or not the filter accepts directories.
        Parameters:
        b - a boolean.
      • acceptsDirectories

        public boolean acceptsDirectories()
        Returns the flag that indicates whether or not the filter accepts directories.
        Returns:
        A boolean.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object