Package org.apache.jackrabbit.vault.util
Class MimeTypes
- java.lang.Object
-
- org.apache.jackrabbit.vault.util.MimeTypes
-
public class MimeTypes extends Object
MimeTypescontains a mapping from extensions to mime types.
-
-
Field Summary
Fields Modifier and Type Field Description static StringAPPLICATION_OCTET_STREAMconstant for "application/octet-stream"
-
Constructor Summary
Constructors Constructor Description MimeTypes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetExtension(String mimeType)Retrieve the default extension for the given mime typestatic StringgetMimeType(String name)Retrieve the mimetype for the given extension or namestatic StringgetMimeType(String name, String defaultType)Retrieve the mimetype for the given extension or namestatic booleanhasExtension(String mimeType, String ext)Checks if the given mime type is mapped to the extensionstatic booleanisBinary(String mimeType)checks if the given mimetype denotes binary contentstatic booleanmatches(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:
trueif binary or ifmimeTypeisnull
-
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:
trueif the given mime type contains that extension
-
-