Enum FormatFilter

java.lang.Object
java.lang.Enum<FormatFilter>
org.apache.sis.internal.storage.image.FormatFilter
All Implemented Interfaces:
Serializable, Comparable<FormatFilter>, java.lang.constant.Constable

enum FormatFilter extends Enum<FormatFilter>
Specify the property to use as a filtering criterion for choosing an image reader or writer. This is used for providing utility methods about image formats.
Since:
1.2
Version:
1.2
  • Enum Constant Details

    • NAME

      public static final FormatFilter NAME
      Filter the providers by format name.
    • SUFFIX

      public static final FormatFilter SUFFIX
      Filter the providers by file extension.
    • MIME

      public static final FormatFilter MIME
      Filter the providers by MIME type.
  • Field Details

    • property

      private final Function<ImageReaderWriterSpi,String[]> property
      The method to invoke for getting the property values (name, suffix or MIME type) to use for filtering.
    • VALID_INPUTS

      private static final Class<?>[] VALID_INPUTS
      Types of image inputs that are accepted by StorageConnector. An input type is accepted if it is equal to one of those types. We do not use Class.isAssignableFrom(Class) because if an image reader requests a sub-type, we can probably not provide it ourselves.
    • VALID_OUTPUTS

      private static final Class<?>[] VALID_OUTPUTS
      Types of image outputs that are accepted by StorageConnector. An output type is accepted if it is equal to one of those types. We do not use Class.isAssignableFrom(Class) because if an image reader requests a sub-type, we can probably not provide it ourselves.
  • Constructor Details

  • Method Details

    • values

      public static FormatFilter[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static FormatFilter valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getServiceProviders

      private <T extends ImageReaderWriterSpi> Iterator<T> getServiceProviders(Class<T> category, String identifier)
      Returns an iterator over all providers of the given category having the given name, suffix or MIME type.
      Type Parameters:
      T - the compile-time type of the category argument.
      Parameters:
      category - either ImageReaderSpi or ImageWriterSpi.
      identifier - the property value to use as a filtering criterion, or null if none.
      Returns:
      an iterator over the requested providers.
    • findProvider

      final ImageReaderSpi findProvider(String identifier, StorageConnector connector, Set<ImageReaderSpi> done) throws IOException, DataStoreException
      Finds a provider for the given input, or returns null if none. This is used by WorldFileStoreProvider.probeContent(StorageConnector).
      Parameters:
      identifier - the property value to use as a filtering criterion, or null if none.
      connector - provider of the input to be given to the canDecodeInput(…) method.
      done - initially empty set to be populated with providers tested by this method.
      Returns:
      the provider for the given input, or null if none was found.
      Throws:
      DataStoreException - if an error occurred while opening a stream from the storage connector.
      IOException - if an error occurred while creating the image reader instance.
    • createReader

      final ImageReader createReader(String identifier, FormatFinder format, Map<ImageReaderSpi,Boolean> deferred) throws IOException, DataStoreException
      Creates a new reader for the given input. Caller needs to invoke this method with an initially empty deferred map, which will be populated by this method. Providers associated to TRUE should be tested again by the caller with an ImageInputStream created by the caller. This is intentionally not done automatically by StorageConnector.
      Parameters:
      identifier - the property value to use as a filtering criterion, or null if none.
      format - provider of the input to be given to the new reader instance.
      deferred - initially empty map to be populated with providers tested by this method.
      Returns:
      the new image reader instance with its input initialized, or null if none was found.
      Throws:
      DataStoreException - if an error occurred while opening a stream from the storage connector.
      IOException - if an error occurred while creating the image reader instance.
    • createWriter

      final ImageWriter createWriter(String identifier, FormatFinder format, RenderedImage image, Map<ImageWriterSpi,Boolean> deferred) throws IOException, DataStoreException
      Creates a new writer for the given output. Caller needs to invoke this method with an initially empty deferred map, which will be populated by this method. Providers associated to TRUE should be tested again by the caller with an ImageOutputStream created by the caller. This is intentionally not done automatically by StorageConnector.
      Parameters:
      identifier - the property value to use as a filtering criterion, or null if none.
      format - provider of the output to be given to the new writer instance.
      image - the image to write, or null if unknown.
      deferred - initially empty map to be populated with providers tested by this method.
      Returns:
      the new image writer instance with its output initialized, or null if none was found.
      Throws:
      DataStoreException - if an error occurred while opening a stream from the storage connector.
      IOException - if an error occurred while creating the image writer instance.