Package org.openbravo.erpCommon.utility
Class MimeTypeUtil
- java.lang.Object
-
- org.openbravo.erpCommon.utility.MimeTypeUtil
-
public class MimeTypeUtil extends Object
Utility class to detect MIME type based on data array.- Author:
- iperdomo
-
-
Constructor Summary
Constructors Constructor Description MimeTypeUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MimeTypeUtil
getInstance()
Returns the instance of the MimeTypeUtil classString
getMimeTypeName(byte[] data)
Returns the MIME type name, (e.g.String
getMimeTypeName(File file)
Returns the MIME type name, (e.g.
-
-
-
Method Detail
-
getInstance
public static MimeTypeUtil getInstance()
Returns the instance of the MimeTypeUtil class- Returns:
- MimeTypeUtil instance
-
getMimeTypeName
public String getMimeTypeName(byte[] data)
Returns the MIME type name, (e.g. image/png) based on the byte array passed as parameter. Returns application/octet-stream if no better match is found.- Parameters:
data
- byte array from which we want to detect the MIME type- Returns:
- MIME Type Name detected or application/octet-stream
-
getMimeTypeName
public String getMimeTypeName(File file)
Returns the MIME type name, (e.g. image/png) based on the file content passed as parameter. Returns application/octet-stream if no better match is found.- Parameters:
file
- file from which we want to detect the MIME type- Returns:
- MIME Type Name detected or application/octet-stream
-
-