public abstract class FormatRecognizer extends Object
(java.io.File,
java.lang.String)
(java.lang.String)
(java.lang.String)
null
.
The priority determines the order we use to ask different recognizers.
Default recognizers have a priority of 100.
The first recognizer, which returns a valid format, determines the format to
be used.
If you ever need to change the priority of different recognizers you should
resort the recognizers
in the Formatizer class by calling ()
.Modifier and Type | Field and Description |
---|---|
static String |
IDENTIFIERS_BASE
identifiers.org base uri.
|
protected static String |
PURL_BASE
purl.org base uri.
|
Constructor and Description |
---|
FormatRecognizer() |
Modifier and Type | Method and Description |
---|---|
static URI |
buildUri(String pre,
String post)
Builds an URI as `start+end` without caring about an exception.
|
static URI |
buildUri(String pre,
String post,
URI defaultUri)
Builds an URI as `start+end` without caring about an exception.
|
abstract URI |
getFormatByParsing(File file,
String mimeType)
Parses the given file and tries to determine the format, such as purl.org
or identifiers.org URI.
|
abstract URI |
getFormatFromExtension(String extension)
Tries to map the given file extension to a format.
|
abstract URI |
getFormatFromMime(String mime)
Tries to map the given mime type to a format.
|
abstract int |
getPriority()
Returns the priority of this format recognizer.
|
protected static final String PURL_BASE
public static final String IDENTIFIERS_BASE
public abstract int getPriority()
public abstract URI getFormatByParsing(File file, String mimeType)
null
.file
- Path to the filemimeType
- MIME type for quick evaluation.public abstract URI getFormatFromMime(String mime)
null
.mime
- MIME typepublic abstract URI getFormatFromExtension(String extension)
null
.extension
- file extensionpublic static URI buildUri(String pre, String post, URI defaultUri)
pre
- the startpost
- the enddefaultUri
- the default URICopyright © 2018 SEMS project @ University of Rostock. All rights reserved.