Package com.stardog.stark.io
Class SupportedFileFormats<T extends FileFormat>
java.lang.Object
com.stardog.stark.io.SupportedFileFormats<T>
Utility class to keep a list of formats that are supported by an application.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Michael Grove
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionAdd a new format to the list of supported formatsAssociate an alias for the given formatbooleanReturn whether or not the specific format is supportedvoidforFileName(String thePath) Return theformatwhich supports the given mimetypeReturn theformatwith the provided name.Return a newSupportedFileFormatswhich contains only the formats which match the given predicate
-
Constructor Details
-
SupportedFileFormats
public SupportedFileFormats() -
SupportedFileFormats
-
-
Method Details
-
add
Add a new format to the list of supported formats- Parameters:
theFormat- the format to add
-
contains
Return whether or not the specific format is supported- Parameters:
theFormat- the format- Returns:
- `true` if supported, `false` otherwise
-
alias
Associate an alias for the given format- Parameters:
theAlias- the aliastheFormat- the format
-
forFile
- Parameters:
thePath- the file to be parsed- Returns:
- the format
- Implementation Notes:
- This will inspect the file extension of the path and attempt to align it with the file extensions registered with all known formats. The default extensions are checked first before all other extensions are checked.
-
forFileName
-
forName
Return theformatwith the provided name. -
forMime
Return theformatwhich supports the given mimetype- Parameters:
theMime- the mimetype- Returns:
- the
formatthat supports the mimetype - Implementation Notes:
- The default mimetypes are checked for _all_ formats before the full set of mimetypes for each format are considered.
-
only
Return a newSupportedFileFormatswhich contains only the formats which match the given predicate- Parameters:
thePredicate- the predicate for filtering- Returns:
- the new `SupportedFileFormats`
-
forEach
-