Class AbstractFileFormatDescriptor

java.lang.Object
com.helger.phive.binary.AbstractFileFormatDescriptor
All Implemented Interfaces:
com.helger.base.name.IHasName, IFileFormatDescriptor
Direct Known Subclasses:
FileFormatDescriptorCSV, FileFormatDescriptorGIF, FileFormatDescriptorJPG, FileFormatDescriptorPDF, FileFormatDescriptorPNG, FileFormatDescriptorPSD, FileFormatDescriptorTIFF, FileFormatDescriptorXLS, FileFormatDescriptorXLSX, FileFormatDescriptorXML

public abstract class AbstractFileFormatDescriptor extends Object implements IFileFormatDescriptor
Abstract implementation of IFileFormatDescriptor.
Author:
Philip Helger
  • Constructor Details

  • Method Details

    • getName

      @Nonnull @Nonempty public final String getName()
      Specified by:
      getName in interface com.helger.base.name.IHasName
    • getShortName

      @Nonnull @Nonempty public final String getShortName()
      Specified by:
      getShortName in interface IFileFormatDescriptor
      Returns:
      The short name of the file format. Defaults to the default name. E.g. "PDF" would be the short name for "Portable File Format".
    • allowedFileExtensions

      @Nonnull @Nonempty @ReturnsMutableObject protected final com.helger.collection.commons.ICommonsSet<String> allowedFileExtensions()
    • getAllAllowedFileExtensions

      @Nonnull @Nonempty @ReturnsMutableCopy public final com.helger.collection.commons.ICommonsSet<String> getAllAllowedFileExtensions()
      Specified by:
      getAllAllowedFileExtensions in interface IFileFormatDescriptor
      Returns:
      A set with all allowed file extensions for this file format. Each extension does NOT contain the leading dot (as in pdf). Each file extension must be in all lowercase characters. Each file extension must be assigned to exactly one file format only. Neither null nor empty.
    • internalAllowedMimeTypes

      @Nonnull @Nonempty @ReturnsMutableObject protected final com.helger.collection.commons.ICommonsSet<String> internalAllowedMimeTypes()
    • getAllAllowedMimeTypes

      @Nonnull @Nonempty @ReturnsMutableCopy public final com.helger.collection.commons.ICommonsSet<String> getAllAllowedMimeTypes()
      Specified by:
      getAllAllowedMimeTypes in interface IFileFormatDescriptor
      Returns:
      A set with all allowed MIME types for this file format. Each MIME type must be in all lowercase characters. The MIME type must not contain any parameters (as e.g. in ; charset=utf-8). Neither null nor empty.
    • internalContentDetectors

      @Nonnull @ReturnsMutableCopy protected final com.helger.collection.commons.ICommonsMap<EPhiveContentValidationMode,IPhiveContentValidator> internalContentDetectors()
    • getAllContentValidators

      @Nonnull @ReturnsMutableCopy public final com.helger.collection.commons.ICommonsMap<EPhiveContentValidationMode,IPhiveContentValidator> getAllContentValidators()
      Specified by:
      getAllContentValidators in interface IFileFormatDescriptor
      Returns:
      A map with all registered content validators for this file format. Not all file formats support one or all detection modes. Never null but maybe empty.
    • findContentValidator

      @Nullable public IPhiveContentValidator findContentValidator(@Nullable EPhiveContentValidationMode... aModes)
      Description copied from interface: IFileFormatDescriptor
      Find the best matching content validator, based on the provided validation modes.
      Specified by:
      findContentValidator in interface IFileFormatDescriptor
      Parameters:
      aModes - The array of detection modes that are tried linearly until the first match is found.
      Returns:
      null if no mode was provided, or this file format does not contain a detector for the provided modes.
    • toString

      public String toString()
      Overrides:
      toString in class Object