Package eu.europa.esig.dss.model
Class MimeType
java.lang.Object
eu.europa.esig.dss.model.MimeType
- All Implemented Interfaces:
Serializable
This class allows handling of different mime types. It also allows addition of a new mime-type.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MimeTypeasic-estatic final MimeTypeasic-sstatic final MimeTypeoctet-streamstatic final MimeTypecertificatestatic final MimeTypecrlstatic final MimeTypehtmlstatic final MimeTypejosestatic final MimeTypejose+jsonstatic final MimeTypejpegstatic final MimeTypejsonstatic final MimeTypeopendocument graphicsstatic final MimeTypeopendocument presentationstatic final MimeTypeopendocument spreadsheetstatic final MimeTypeopendocument textstatic final MimeTypepdfstatic final MimeTypepkcs7-signaturestatic final MimeTypepngstatic final MimeTypesvgstatic final MimeTypeplain textstatic final MimeTypetimestamp-tokenstatic final MimeTypexmlstatic final MimeTypezip -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddefineFileExtension(String extension) This method allows to define a new relationship between a file extension and aMimeType.booleanstatic MimeTypeThis 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) Returns the file exception for the provided MimeTypestatic StringgetFileExtension(String fileName) Returns the file extension based on the position of the '.' in the fileName.Gets String identifying the MimeTypeinthashCode()voidsetMimeTypeString(String mimeTypeString) This setter is used by the web-services.toString()
-
Field Details
-
BINARY
octet-stream -
XML
xml -
HTML
html -
PDF
pdf -
PKCS7
pkcs7-signature -
JSON
json -
JOSE
jose -
JOSE_JSON
jose+json -
TST
timestamp-token -
ZIP
zip -
ASICS
asic-s -
ASICE
asic-e -
ODT
opendocument text -
ODS
opendocument spreadsheet -
ODP
opendocument presentation -
ODG
opendocument graphics -
TEXT
plain text -
CRL
crl -
CER
certificate -
PNG
png -
JPEG
jpeg -
SVG
svg
-
-
Constructor Details
-
MimeType
public MimeType()This constructor is used only by the web-services. -
MimeType
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 Details
-
getMimeTypeString
Gets String identifying the MimeType- Returns:
- the mimeTypeString
-
setMimeTypeString
This setter is used by the web-services.- Parameters:
mimeTypeString- is a string identifier composed of two parts: a "type" and a "subtype"
-
fromFileName
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
-
getExtension
Returns the file exception for the provided MimeType- Parameters:
mimeType-MimeTypeto get an extension for- Returns:
- the exception
Stringassigned to the given MimeType - Throws:
DSSException- in case if the extension for the requested MimeType is not found
-
getFileExtension
Returns the file extension based on the position of the '.' in the fileName. File paths as "xxx.y/toto" are not handled.- Parameters:
fileName- to be analysed- Returns:
- the file extension or null
-
fromFile
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
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
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.
-
hashCode
public int hashCode() -
equals
-
toString
-