Package eu.europa.esig.dss.model
Class MimeType
- java.lang.Object
-
- eu.europa.esig.dss.model.MimeType
-
- All Implemented Interfaces:
Serializable
public class MimeType extends Object implements Serializable
This class allows to handle different mime types. It also allows to add (define) new mime-type.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static MimeTypeASICEstatic MimeTypeASICSstatic MimeTypeBINARYstatic MimeTypeCERstatic MimeTypeCRLstatic MimeTypeHTMLstatic MimeTypeJPEGstatic MimeTypeODSstatic MimeTypeODTstatic MimeTypePDFstatic MimeTypePKCS7static MimeTypePNGstatic MimeTypeTEXTstatic MimeTypeTSTstatic MimeTypeXML
-
Method Summary
Modifier and Type Method Description voiddefineFileExtension(String extension)This method allows to define a new relationship between a file extension and aMimeType.booleanequals(Object obj)static MimeTypefromFile(File file)This method returns the mime-type extrapolated from the file.static MimeTypefromFileName(String fileName)This method returns the mime-type extrapolated from the file name.static MimeTypefromMimeTypeString(String mimeTypeString)This method returns the first representation of theMimeTypecorresponding to the given mime-type string.static StringgetExtension(MimeType mimeType)static StringgetFileExtension(String path)Returns the file extension based on the position of the '.' in the path.StringgetMimeTypeString()inthashCode()voidsetMimeTypeString(String mimeTypeString)This setter is used by the web-services.
-
-
-
Field Detail
-
BINARY
public static final MimeType BINARY
-
XML
public static final MimeType XML
-
HTML
public static final MimeType HTML
-
PDF
public static final MimeType PDF
-
PKCS7
public static final MimeType PKCS7
-
TST
public static final MimeType TST
-
ASICS
public static final MimeType ASICS
-
ASICE
public static final MimeType ASICE
-
ODT
public static final MimeType ODT
-
ODS
public static final MimeType ODS
-
TEXT
public static final MimeType TEXT
-
CRL
public static final MimeType CRL
-
CER
public static final MimeType CER
-
PNG
public static final MimeType PNG
-
JPEG
public static final MimeType JPEG
-
-
Constructor Detail
-
MimeType
public MimeType()
This constructor is used only by the web-services.
-
MimeType
public MimeType(String mimeTypeString, String extension)
This constructor allows to create a new MimeType related to given file extension. Be careful, if the file extension has already an associatedMimeTypethen this relation will be lost.- Parameters:
mimeTypeString- is a string identifier composed of two parts: a "type" and a "subtype"extension- to be defined. Example: "txt", note that there is no point before the extension name.
-
-
Method Detail
-
getMimeTypeString
public String getMimeTypeString()
- Returns:
- the mimeTypeString
-
setMimeTypeString
public void setMimeTypeString(String mimeTypeString)
This setter is used by the web-services.- Parameters:
mimeTypeString- is a string identifier composed of two parts: a "type" and a "subtype"
-
fromFileName
public static MimeType fromFileName(String fileName)
This method returns the mime-type extrapolated from the file name.- Parameters:
fileName- the file name to be analysed- Returns:
- the extrapolated mime-type of the file name
-
getFileExtension
public static String getFileExtension(String path)
Returns the file extension based on the position of the '.' in the path. The paths as "xxx.y/toto" are not handled.- Parameters:
path- to be analysed- Returns:
- the file extension or null
-
fromFile
public static MimeType fromFile(File file)
This method returns the mime-type extrapolated from the file.- Parameters:
file- the file to be analysed- Returns:
- the extrapolated mime-type of the file
-
fromMimeTypeString
public static MimeType fromMimeTypeString(String mimeTypeString)
This method returns the first representation of theMimeTypecorresponding to the given mime-type string.- Parameters:
mimeTypeString- is a string identifier composed of two parts: a "type" and a "subtype"- Returns:
- the extrapolated mime-type from the
String
-
defineFileExtension
public void defineFileExtension(String extension)
This method allows to define a new relationship between a file extension and aMimeType.- Parameters:
extension- to be defined. Example: "txt", note that there is no point before the extension name.
-
-