Package com.helger.phive.binary
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
Abstract implementation of
IFileFormatDescriptor.- Author:
- Philip Helger
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFileFormatDescriptor(String sName, String sShortName, Collection<String> aAllowedFileExtensions, Collection<String> aAllowedMimeTypes, Map<EPhiveContentValidationMode, IPhiveContentValidator> aContentValidators) -
Method Summary
Modifier and TypeMethodDescriptionprotected final com.helger.collection.commons.ICommonsSet<String> findContentValidator(EPhiveContentValidationMode... aModes) Find the best matching content validator, based on the provided validation modes.final com.helger.collection.commons.ICommonsSet<String> final com.helger.collection.commons.ICommonsSet<String> final com.helger.collection.commons.ICommonsMap<EPhiveContentValidationMode, IPhiveContentValidator> final StringgetName()final Stringprotected final com.helger.collection.commons.ICommonsSet<String> protected final com.helger.collection.commons.ICommonsMap<EPhiveContentValidationMode, IPhiveContentValidator> toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.phive.binary.IFileFormatDescriptor
getContentValidatorFavourAccuracy, getContentValidatorFavourSpeed
-
Constructor Details
-
AbstractFileFormatDescriptor
protected AbstractFileFormatDescriptor(@Nonnull @Nonempty String sName, @Nullable String sShortName, @Nonnull @Nonempty Collection<String> aAllowedFileExtensions, @Nonnull @Nonempty Collection<String> aAllowedMimeTypes, @Nonnull Map<EPhiveContentValidationMode, IPhiveContentValidator> aContentValidators)
-
-
Method Details
-
getName
- Specified by:
getNamein interfacecom.helger.base.name.IHasName
-
getShortName
- Specified by:
getShortNamein interfaceIFileFormatDescriptor- 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:
getAllAllowedFileExtensionsin interfaceIFileFormatDescriptor- 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. Neithernullnor 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:
getAllAllowedMimeTypesin interfaceIFileFormatDescriptor- 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). Neithernullnor 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:
getAllContentValidatorsin interfaceIFileFormatDescriptor- Returns:
- A map with all registered content validators for this file format.
Not all file formats support one or all detection modes. Never
nullbut maybe empty.
-
findContentValidator
@Nullable public IPhiveContentValidator findContentValidator(@Nullable EPhiveContentValidationMode... aModes) Description copied from interface:IFileFormatDescriptorFind the best matching content validator, based on the provided validation modes.- Specified by:
findContentValidatorin interfaceIFileFormatDescriptor- Parameters:
aModes- The array of detection modes that are tried linearly until the first match is found.- Returns:
nullif no mode was provided, or this file format does not contain a detector for the provided modes.
-
toString
-