Package org.apache.jackrabbit.vault.util
Class MimeTypes
- java.lang.Object
-
- org.apache.jackrabbit.vault.util.MimeTypes
-
public class MimeTypes extends java.lang.Object
MimeTypes
contains a mapping from extensions to mime types.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.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 java.lang.String
getExtension(java.lang.String mimeType)
Retrieve the default extension for the given mime typestatic java.lang.String
getMimeType(java.lang.String name)
Retrieve the mimetype for the given extension or namestatic java.lang.String
getMimeType(java.lang.String name, java.lang.String defaultType)
Retrieve the mimetype for the given extension or namestatic boolean
hasExtension(java.lang.String mimeType, java.lang.String ext)
Checks if the given mime type is mapped to the extensionstatic boolean
isBinary(java.lang.String mimeType)
checks if the given mimetype denotes binary contentstatic boolean
matches(java.lang.String name, java.lang.String mimeType, java.lang.String defaultType)
-
-
-
Field Detail
-
APPLICATION_OCTET_STREAM
public static final java.lang.String APPLICATION_OCTET_STREAM
constant for "application/octet-stream"- See Also:
- Constant Field Values
-
-
Method Detail
-
getMimeType
public static java.lang.String getMimeType(java.lang.String name)
Retrieve the mimetype for the given extension or name- Parameters:
name
- the name- Returns:
- the mimetype or
null
-
getMimeType
public static java.lang.String getMimeType(java.lang.String name, java.lang.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 java.lang.String getExtension(java.lang.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(java.lang.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(java.lang.String mimeType, java.lang.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
-
matches
public static boolean matches(java.lang.String name, java.lang.String mimeType, java.lang.String defaultType)
-
-