Class 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 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 format
         major / minor
         

        E.g. unknown is:

         application / octet - stream
         
        Throws:
        DataFormatException - if using a non valid MIME type.
    • Method Detail

      • guessDataFormat

        public static DataFormat guessDataFormat​(java.io.InputStream input)
        Guess the DataFormat for a given file
        Parameters:
        input - a InputStream 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 field mimeType.
        Returns:
        the mimeType
      • setMimeType

        public void setMimeType​(java.lang.String mimeType)
        Setter for the field mimeType.
        Parameters:
        mimeType - the mimeType to set