loci.formats.gui

## Class FormatFileFilter

- java.lang.Object
- - javax.swing.filechooser.FileFilter
  - - loci.formats.gui.FormatFileFilter

- All Implemented Interfaces:
    java.io.FileFilter, java.lang.Comparable

      public class FormatFileFilter
      extends javax.swing.filechooser.FileFilter
      implements java.io.FileFilter, java.lang.Comparable

  A file filter for a biological file format, for use with a JFileChooser.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private boolean` | `allowOpen` Whether it is ok to open a file to determine its type.
    `private java.lang.String` | `desc` Description.
    `private IFormatReader` | `reader` Associated file format reader.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FormatFileFilter(IFormatReader reader)` Constructs a new filter that accepts files of the given reader's type.
    `FormatFileFilter(IFormatReader reader, boolean allowOpen)` Constructs a new filter that accepts files of the given reader's type, allowing the reader to open files only if the allowOpen flag is set.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `accept(java.io.File f)` Accepts files in accordance with the file format reader.
    `int` | `compareTo(java.lang.Object o)` Compares two FileFilter objects alphanumerically.
    `java.lang.String` | `getDescription()` Gets the filter's description.
    `IFormatReader` | `getReader()` Returns the filter's reader.
    `java.lang.String` | `toString()` Gets a string representation of this file filter.

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### reader

          private IFormatReader reader

      Associated file format reader.

    - #### allowOpen

          private boolean allowOpen

      Whether it is ok to open a file to determine its type.

    - #### desc

          private java.lang.String desc

      Description.

  - ### Constructor Detail

    - #### FormatFileFilter

          public FormatFileFilter(IFormatReader reader)

      Constructs a new filter that accepts files of the given reader's type.

    - #### FormatFileFilter

          public FormatFileFilter(IFormatReader reader,
                                  boolean allowOpen)

      Constructs a new filter that accepts files of the given reader's type, allowing the reader to open files only if the allowOpen flag is set.
      Parameters:
        `reader` - The reader to use for verifying a file's type.
        `allowOpen` - Whether it is ok to open a file to determine its type.

  - ### Method Detail

    - #### accept

          public boolean accept(java.io.File f)

      Accepts files in accordance with the file format reader.
      Specified by:
        `accept` in interface `java.io.FileFilter`
      Specified by:
        `accept` in class `javax.swing.filechooser.FileFilter`

    - #### getReader

          public IFormatReader getReader()

      Returns the filter's reader.

    - #### getDescription

          public java.lang.String getDescription()

      Gets the filter's description.
      Specified by:
        `getDescription` in class `javax.swing.filechooser.FileFilter`

    - #### toString

          public java.lang.String toString()

      Gets a string representation of this file filter.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### compareTo

          public int compareTo(java.lang.Object o)

      Compares two FileFilter objects alphanumerically.
      Specified by:
        `compareTo` in interface `java.lang.Comparable`

Copyright © 2026 Open Microscopy Environment