public final class FormatRegistry extends Object
Modifier and Type | Method and Description |
---|---|
static Format |
detectFileFormat(SeekableInputStream stream)
Detect and return the format of the file by looking at the first bytes of a file.
|
static ClassLoader |
getAdditionalFormatClassLoader()
Returns an additional context class loader used to load format providers.
|
static Format |
getFormat(MimeType type) |
static Format |
getFormatForExtension(String extension)
Retrieve the first FormatInfo which has a default extension which matches the given extension.
|
static List<Format> |
getFormatInformation()
Retrieve the format information for the currently registered document types.
|
static Integer |
getPriority(Format format)
Return the overridden priority for the given format or
null if the default
priority applies. |
static void |
setAdditionalFormatClassLoader(ClassLoader formatClassLoader)
Sets an additional context classloader used to load format providers.
|
static void |
setPriority(Format format,
int priority)
Override the default detection priority of the given format, replacing it with the given
priority.
|
public static ClassLoader getAdditionalFormatClassLoader()
null
, the system class loader will be used.public static void setPriority(Format format, int priority)
public static Integer getPriority(Format format)
null
if the default
priority applies. The default priority of a Format
can be retrieved by a call of
Format.getPriority()
.format
- the format the priority is asked fornull
which indicates that
the default priority of the format applies.public static Format getFormatForExtension(String extension)
public static List<Format> getFormatInformation()
Iterator
of FormatInfopublic static void setAdditionalFormatClassLoader(ClassLoader formatClassLoader)
null
, the system class loader will be used. Changing this loader must happen
before any format is loaded, because the format provider access lazily takes place while the
first loading process. Afterwards no further access is done.formatClassLoader
- the new class loader to usepublic static Format detectFileFormat(SeekableInputStream stream) throws IOException
stream
- the raw data streamIOException
- if an io error or an unsupported encoding occurredCopyright © 2024 levigo holding gmbh. All rights reserved.