Class DataFormat
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.metadata.UntypedData
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.metadata.DataFormat
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<UntypedData>
public class DataFormat extends UntypedData
Data type to manage MIME types.For MIME type definition, we make use of the
Tika
library package.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static DataFormat
UNKNOWN_FORMAT
The unknown format-
Fields inherited from class de.ipk_gatersleben.bit.bi.edal.primary_data.metadata.UntypedData
ALL_RIGHTS_RESERVED, EMPTY, string
-
-
Constructor Summary
Constructors Constructor Description DataFormat()
construct a DataFormat object with unknown typeDataFormat(java.lang.String mimeType)
Constructor for DataFormat.
-
Method Summary
Modifier and Type Method Description int
compareTo(UntypedData datatype)
java.lang.String
getMimeType()
Getter for the fieldmimeType
.static DataFormat
guessDataFormat(java.io.InputStream input)
Guess the DataFormat for a given filevoid
setMimeType(java.lang.String mimeType)
Setter for the fieldmimeType
.java.lang.String
toString()
-
-
-
Field Detail
-
UNKNOWN_FORMAT
public static final DataFormat UNKNOWN_FORMAT
The unknown format
-
-
Constructor Detail
-
DataFormat
public DataFormat()
construct a DataFormat object with unknown type
-
DataFormat
public DataFormat(java.lang.String mimeType) throws DataFormatException
Constructor for DataFormat.- Parameters:
mimeType
- the data format as MIME type in the formatmajor / minor
E.g. unknown is:
application / octet - stream
- Throws:
DataFormatException
- if using a non valid MIME type.
-
-
Method Detail
-
compareTo
public int compareTo(UntypedData datatype)
- Specified by:
compareTo
in interfacejava.lang.Comparable<UntypedData>
- Overrides:
compareTo
in classUntypedData
-
guessDataFormat
public static DataFormat guessDataFormat(java.io.InputStream input)
Guess the DataFormat for a given file- Parameters:
input
- aInputStream
object.- Returns:
- the guessed DataFormat object; if format is not recognized then
the return
UNKNOWN_FORMAT
-
getMimeType
public java.lang.String getMimeType()
Getter for the fieldmimeType
.- Returns:
- the mimeType
-
setMimeType
public void setMimeType(java.lang.String mimeType)
Setter for the fieldmimeType
.- Parameters:
mimeType
- the mimeType to set
-
toString
public java.lang.String toString()
- Overrides:
toString
in classUntypedData
-
-