Class FileFormat

java.lang.Object
de.iip_ecosphere.platform.support.FileFormat
Direct Known Subclasses:
ExtensionBasedFileFormat

public abstract class FileFormat extends Object
Represents a file format, e.g., to indicate which formats are supported by an importer/exporter.
Author:
Holger Eichelberger, SSE
  • Field Details

    • name

      private String name
    • description

      private String description
  • Constructor Details

    • FileFormat

      public FileFormat(String name, String description)
      Creates an instance.
      Parameters:
      name - the name of the file format
      description - a free-text description of the file format (may be null, turned into an empty string then)
      Throws:
      IllegalArgumentException - if name is not given
  • Method Details

    • getName

      public String getName()
      Returns the name of the file format.
      Returns:
      the name
    • getDescription

      public String getDescription()
      Returns the free-text description of the file format.
      Returns:
      the free-text description
    • matches

      public abstract boolean matches(File file)
      Returns whether the given file matches the file format. This may be based on an anlysis of magic numbers, the file extension, etc.
      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 Object