Class ExtensionBasedFileFormat

java.lang.Object
de.iip_ecosphere.platform.support.FileFormat
de.iip_ecosphere.platform.support.ExtensionBasedFileFormat

public class ExtensionBasedFileFormat extends FileFormat
A file format just based on extensions. Although not nice, still many file formats are just identified by extensions, also as this rather easy to check.
Author:
Holger Eichelberger, SSE
  • Field Details

    • extension

      private String extension
  • Constructor Details

    • ExtensionBasedFileFormat

      public ExtensionBasedFileFormat(String extension, String name, String description)
      Creates an instance.
      Parameters:
      extension - the file name extension to check for, without the "." (normalized out)
      name - the name of the file format
      description - a free-text description of the file format
  • Method Details

    • getExtension

      public String getExtension()
      Returns the extension.
      Returns:
      the extension (without leading ".")
    • matches

      public boolean matches(File file)
      Description copied from class: FileFormat
      Returns whether the given file matches the file format. This may be based on an anlysis of magic numbers, the file extension, etc.
      Specified by:
      matches in class FileFormat
      Parameters:
      file - the file to check
      Returns:
      true if the given file matches this file format, false else
    • toString

      public String toString()
      Overrides:
      toString in class FileFormat