Package org.eclipse.rdf4j.common.lang.service

## Class FileFormatServiceRegistry<FF extends FileFormat,​S>

- java.lang.Object
- - org.eclipse.rdf4j.common.lang.service.ServiceRegistry<FF,​S>
  - - org.eclipse.rdf4j.common.lang.service.FileFormatServiceRegistry<FF,​S>

- Direct Known Subclasses:
    `BooleanQueryResultParserRegistry`, `BooleanQueryResultWriterRegistry`, `RDFParserRegistry`, `RDFWriterRegistry`, `TupleQueryResultParserRegistry`, `TupleQueryResultWriterRegistry`

      public abstract class FileFormatServiceRegistry<FF extends FileFormat,​S>
      extends ServiceRegistry<FF,​S>

  A special `ServiceRegistry` for `FileFormat` related services. This FileFormat-specific subclass offers some utility methods for matching MIME types and file extensions to the file formats of registered services.
  Author:
    Arjohn Kampman

- - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.common.lang.service.ServiceRegistry

      `logger, services`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `FileFormatServiceRegistry​(Class<S> serviceClass)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Optional<FF>` | `getFileFormatForFileName​(String fileName)` | Tries to match the extension of a file name against the list of registred file formats.
    `Optional<FF>` | `getFileFormatForMIMEType​(String mimeType)` | Tries to match a MIME type against the list of registered file formats.

    - ### Methods inherited from class org.eclipse.rdf4j.common.lang.service.ServiceRegistry

      `add, get, getAll, getKey, getKeys, has, remove`

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

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

- - ### Constructor Detail

    - #### FileFormatServiceRegistry

          protected FileFormatServiceRegistry​(Class<S> serviceClass)

  - ### Method Detail

    - #### getFileFormatForMIMEType

          public Optional<FF> getFileFormatForMIMEType​(String mimeType)

      Tries to match a MIME type against the list of registered file formats.
      Parameters:
        `mimeType` - A MIME type, e.g. "text/plain".
      Returns:
        The matching `FileFormat`, or `Optional.empty()` if no match was found.

    - #### getFileFormatForFileName

          public Optional<FF> getFileFormatForFileName​(String fileName)

      Tries to match the extension of a file name against the list of registred file formats.
      Parameters:
        `fileName` - A file name.
      Returns:
        The matching `FileFormat`, or `Optional.empty()` if no match was found.