loci.formats

## Class FormatHandler

- java.lang.Object
- - loci.formats.FormatHandler

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, IFormatHandler, IMetadataConfigurable
  Direct Known Subclasses:
    FormatReader, FormatWriter

      public abstract class FormatHandler
      extends java.lang.Object
      implements IFormatHandler

  Abstract superclass of all biological file format readers and writers.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String[]` | `COMPRESSION_SUFFIXES` Suffixes for supported compression types.
    `protected java.lang.String` | `currentId` Name of current file.
    `protected java.lang.String` | `format` Name of this file format.
    `protected static org.slf4j.Logger` | `LOGGER`
    `protected MetadataOptions` | `metadataOptions` Metadata parsing options.
    `protected java.lang.String[]` | `suffixes` Valid suffixes for this file format.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FormatHandler(java.lang.String format, java.lang.String suffix)` Constructs a format handler with the given name and default suffix.
    `FormatHandler(java.lang.String format, java.lang.String[] suffixes)` Constructs a format handler with the given name and default suffixes.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `checkSuffix(java.lang.String name, java.lang.String suffix)` Performs suffix matching for the given filename.
    `static boolean` | `checkSuffix(java.lang.String name, java.lang.String[] suffixList)` Performs suffix matching for the given filename.
    `java.lang.String` | `getFormat()` Gets the name of this file format.
    `MetadataOptions` | `getMetadataOptions()`
    `java.lang.Class<?>` | `getNativeDataType()` Returns the native data type of image planes for this reader, as returned by `IFormatReader.openPlane(int, int, int, int, int)` or `IFormatWriter.savePlane(int, java.lang.Object)`.
    `java.lang.String[]` | `getSuffixes()` Gets the default file suffixes for this file format.
    `java.util.Set<MetadataLevel>` | `getSupportedMetadataLevels()`
    `boolean` | `isThisType(java.lang.String name)` Checks if a file matches the type of this format handler.
    `void` | `setMetadataOptions(MetadataOptions options)`

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

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

    - ### Methods inherited from interface loci.formats.IFormatHandler

      `setId`

    - ### Methods inherited from interface java.io.Closeable

      `close`

- - ### Field Detail

    - #### LOGGER

          protected static final org.slf4j.Logger LOGGER

    - #### COMPRESSION_SUFFIXES

          public static final java.lang.String[] COMPRESSION_SUFFIXES

      Suffixes for supported compression types.

    - #### format

          protected java.lang.String format

      Name of this file format.

    - #### suffixes

          protected java.lang.String[] suffixes

      Valid suffixes for this file format.

    - #### currentId

          protected java.lang.String currentId

      Name of current file.

    - #### metadataOptions

          protected MetadataOptions metadataOptions

      Metadata parsing options.

  - ### Constructor Detail

    - #### FormatHandler

          public FormatHandler(java.lang.String format,
                               java.lang.String suffix)

      Constructs a format handler with the given name and default suffix.

    - #### FormatHandler

          public FormatHandler(java.lang.String format,
                               java.lang.String[] suffixes)

      Constructs a format handler with the given name and default suffixes.

  - ### Method Detail

    - #### getSupportedMetadataLevels

          public java.util.Set<MetadataLevel> getSupportedMetadataLevels()

      Specified by:
        `getSupportedMetadataLevels` in interface `IMetadataConfigurable`

    - #### getMetadataOptions

          public MetadataOptions getMetadataOptions()

      Specified by:
        `getMetadataOptions` in interface `IMetadataConfigurable`

    - #### setMetadataOptions

          public void setMetadataOptions(MetadataOptions options)

      Specified by:
        `setMetadataOptions` in interface `IMetadataConfigurable`

    - #### isThisType

          public boolean isThisType(java.lang.String name)

      Checks if a file matches the type of this format handler. The default implementation checks filename suffixes against those known for this format.
      Specified by:
        `isThisType` in interface `IFormatHandler`

    - #### getFormat

          public java.lang.String getFormat()

      Description copied from interface: `IFormatHandler`
      Gets the name of this file format.
      Specified by:
        `getFormat` in interface `IFormatHandler`

    - #### getSuffixes

          public java.lang.String[] getSuffixes()

      Description copied from interface: `IFormatHandler`
      Gets the default file suffixes for this file format.
      Specified by:
        `getSuffixes` in interface `IFormatHandler`

    - #### getNativeDataType

          public java.lang.Class<?> getNativeDataType()

      Description copied from interface: `IFormatHandler`
      Returns the native data type of image planes for this reader, as returned by `IFormatReader.openPlane(int, int, int, int, int)` or `IFormatWriter.savePlane(int, java.lang.Object)`. For most readers this type will be a byte array; however, some readers call external APIs that work with other types such as `BufferedImage`.
      Specified by:
        `getNativeDataType` in interface `IFormatHandler`

    - #### checkSuffix

          public static boolean checkSuffix(java.lang.String name,
                                            java.lang.String suffix)

      Performs suffix matching for the given filename.

    - #### checkSuffix

          public static boolean checkSuffix(java.lang.String name,
                                            java.lang.String[] suffixList)

      Performs suffix matching for the given filename.

Copyright © 2026 Open Microscopy Environment