Package org.apache.jackrabbit.vault.util
Class MimeTypes
- java.lang.Object
-
- org.apache.jackrabbit.vault.util.MimeTypes
-
public class MimeTypes extends Object
MimeTypes
contains a mapping from extensions to mime types.
-
-
Field Summary
Fields Modifier and Type Field Description static String
APPLICATION_OCTET_STREAM
constant for "application/octet-stream"
-
Constructor Summary
Constructors Constructor Description MimeTypes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getExtension(String mimeType)
Retrieve the default extension for the given mime typestatic String
getMimeType(String name)
Retrieve the mimetype for the given extension or namestatic String
getMimeType(String name, String defaultType)
Retrieve the mimetype for the given extension or namestatic boolean
hasExtension(String mimeType, String ext)
Checks if the given mime type is mapped to the extensionstatic boolean
isBinary(String mimeType)
checks if the given mimetype denotes binary contentstatic boolean
matches(String name, String mimeType, String defaultType)
-
-
-
Field Detail
-
APPLICATION_OCTET_STREAM
public static final String APPLICATION_OCTET_STREAM
constant for "application/octet-stream"- See Also:
- Constant Field Values
-
-
Method Detail
-
getMimeType
public static String getMimeType(String name)
Retrieve the mimetype for the given extension or name- Parameters:
name
- the name- Returns:
- the mimetype or
null
-
getMimeType
public static String getMimeType(String name, String defaultType)
Retrieve the mimetype for the given extension or name- Parameters:
name
- the namedefaultType
- type to return if no mapping is found.- Returns:
- the mimetype or
null
-
getExtension
public static String getExtension(String mimeType)
Retrieve the default extension for the given mime type- Parameters:
mimeType
- the mime type- Returns:
- the extension or null
-
isBinary
public static boolean isBinary(String mimeType)
checks if the given mimetype denotes binary content- Parameters:
mimeType
- the mime type- Returns:
true
if binary or ifmimeType
isnull
-
hasExtension
public static boolean hasExtension(String mimeType, String ext)
Checks if the given mime type is mapped to the extension- Parameters:
mimeType
- the mime typeext
- the extension- Returns:
true
if the given mime type contains that extension
-
-