public abstract class Format extends Object implements Cloneable
Modifier and Type | Field and Description |
---|---|
protected static ProductInformation.Artifact |
BASE_FORMAT_VERSION
The format version artifact of this abstract base format.
|
protected static int |
DEFAULT_PRIORITY |
protected static int |
MAX_PRIORITY |
protected static int |
MIN_PRIORITY |
Modifier | Constructor and Description |
---|---|
protected |
Format()
Default-constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canRead()
Return whether this Format can be read, i.e.
|
boolean |
canWrite()
Return whether this Format can be written, i.e.
|
Format |
create(MimeType type)
Create an instance of this format corresponding to the given MIME type.
|
FormatReader |
createReader()
Instantiate a new
FormatReader for this format. |
FormatWriter |
createWriter()
Instantiate a new
FormatWriter for this format. |
boolean |
equals(Object obj)
The default equality implementation for formats is based on class equality.
|
abstract String[] |
getDefaultExtensions()
The default file-extension for the format.
|
abstract String |
getDescription()
Describes the format represented by this instance.
|
abstract MimeType |
getMimeType()
Return the string-encoded MIME-Type of the format.
|
abstract String |
getName()
Return the format's name.
|
int |
getPriority()
Return the priority with which this format will be selected, if there are multiple eligible ones.
|
abstract String |
getVersion()
The version of the format support.
|
int |
hashCode()
The default hash-code implementation for formats is based on the class hash-code.
|
boolean |
isSecondary()
Return whether this format is a secondary format.
|
boolean |
isSupported(MimeType type)
Determine whether this format supports the given MIME type.
|
abstract boolean |
matches(SeekableInputStream stream)
Within the read process this method is called to auto-determine the format of the data passed.
|
String |
toString()
Returns a String-representation of this Format
|
protected static final ProductInformation.Artifact BASE_FORMAT_VERSION
protected static final int MIN_PRIORITY
protected static final int MAX_PRIORITY
protected static final int DEFAULT_PRIORITY
public String toString()
public abstract String[] getDefaultExtensions()
public abstract String getDescription()
public abstract String getName()
public abstract String getVersion()
public abstract MimeType getMimeType()
public abstract boolean matches(SeekableInputStream stream) throws IOException
stream
- contains the data to be tested.IOException
- if an io error occurspublic int getPriority()
MIN_PRIORITY
,
DEFAULT_PRIORITY
,
MAX_PRIORITY
public boolean canRead()
createReader()
is able to create a
reader.true
if we can.public FormatReader createReader()
FormatReader
for this format.FormatReader
for this formatUnsupportedOperationException
- if this format does not support readingpublic boolean canWrite()
createWriter()
is able to create
a writer.true
if we can.public FormatWriter createWriter()
FormatWriter
for this format.FormatWriter
for this formatUnsupportedOperationException
- if this format does not support writingpublic boolean isSecondary()
true
if this format is a secondary formatpublic int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
public boolean equals(Object obj)
equals
in class Object
obj
- the object to comparetrue
if the givaen object is the same, otherwise false
Object.equals(java.lang.Object)
public boolean isSupported(MimeType type)
type
- the mime type in questionpublic Format create(MimeType type)
type
- the MIME typeIllegalArgumentException
- if the given type is not supported by this format.Copyright © 2024 levigo holding gmbh. All rights reserved.