java.lang.Object
org.bzdev.imageio.ImageMimeInfo
Information about MIME types for writable images handled by
javax.imageio classes.
The methods are all static.
Note: The term "MIME type" is the historic one. Current IETF usage has replaced this with "media type".
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]
Get all suffixes (file extensions) associated with Java-supported images that can be used for writing files.static String
getExtensionForMimeType
(String mtype) Get the file extension matching a MIME type.static String
getFilenameExtension
(File file) Get the extension for a file.static String
getFilenameExtension
(String filename) Get the extension for a file name.static String
getFormatNameForFile
(File file) Get the format name given a file.static String
getFormatNameForFile
(String filename) Get the format name given a file.static String
getFormatNameForMimeType
(String mimeType) Get the javax.imageio format name matching a MIME type.static String
getFormatNameForSuffix
(String suffix) Get the format name given a file-name extension or suffix.Get the names of the formats supported by the javax.imageio package.Get the entry set mapping mime types to the corresponding suffixes.static String
getMimeType
(String name) Get the MIME type for a format namestatic String
getMIMETypeForSuffix
(String suffix) Get the MIME type for a suffix.Get the MIME types of the image types supported by the javax.imageio package.Get a set of Map.Entry<String,String> containing each entry in the suffix to MIME type map.static String[]
getSuffixes
(String mimeType) Get the suffixes matching a MIME type.Get a set of all suffixes for writable formats.static int
Get the number of suffixesstatic boolean
supportsMIMEType
(String mimeType) Determine if a MIME type is supported.
-
Constructor Details
-
ImageMimeInfo
public ImageMimeInfo()
-
-
Method Details
-
getMIMETypeForSuffix
Get the MIME type for a suffix. The suffix does not include the period separating it from the rest of a file name. The mapping is not case sensitive. The rationale for not distinguishing between upper and lower case characters is that image file are sometimes imported from external sources (e.g., a digital camera) that may use a different convention regarding the case of file names.- Parameters:
suffix
- the suffix- Returns:
- the MIME type; null if the suffix is not recognized as one used for image files
-
getMimeToSuffixesEntrySet
Get the entry set mapping mime types to the corresponding suffixes.- Returns:
- the entry set
-
numberOfSuffixes
public static int numberOfSuffixes()Get the number of suffixes- Returns:
- the number of suffixes
-
getSuffixEntrySet
Get a set of Map.Entry<String,String> containing each entry in the suffix to MIME type map.- Returns:
- a set of of Map.Entry<String,String> representing the entries in the suffix to MIME type map.
-
getSuffixSet
Get a set of all suffixes for writable formats.- Returns:
- the set of file suffixes
-
getExtensionForMimeType
Get the file extension matching a MIME type.- Parameters:
mtype
- the MIME type- Returns:
- the file extension
-
getFilenameExtension
Get the extension for a file.- Parameters:
file
- the file- Returns:
- the file extension; null if there is no extension; an empty string if the file name ends in a period
-
getFilenameExtension
Get the extension for a file name.- Parameters:
filename
- the filename- Returns:
- the file extension; null if there is no extension; an empty string if the file name ends in a period
-
getFormatNameForFile
Get the format name given a file. The format name is determined by the file's extension.- Parameters:
file
- the file- Returns:
- the format name for the file; null if there is none or if the format is not recognized by Java
-
getFormatNameForFile
Get the format name given a file. The format name is determined by the file's extension.- Parameters:
filename
- the file name- Returns:
- the format name for the file; null if there is none or if the format is not recognized by Java
-
getFormatNameForSuffix
Get the format name given a file-name extension or suffix.- Parameters:
suffix
- the suffix or file-name extension- Returns:
- the format name; null if there is none or if the format is not recognized by Java
-
getAllExt
Get all suffixes (file extensions) associated with Java-supported images that can be used for writing files.- Returns:
- a set of file name suffixes
-
supportsMIMEType
Determine if a MIME type is supported.- Parameters:
mimeType
- a MIME type- Returns:
- true if the MIME type is supported by javax.imageio operations; false otherwise
-
getFormatNameForMimeType
Get the javax.imageio format name matching a MIME type.- Parameters:
mimeType
- a MIME type- Returns:
- a standard javax.imageio format name matching the MIME type
-
getSuffixes
Get the suffixes matching a MIME type.- Parameters:
mimeType
- a MIME type- Returns:
- the suffixes for the MIME type
-
getMimeType
Get the MIME type for a format name- Parameters:
name
- the format name- Returns:
- the MIME type matching a format name.
-
getFormatNames
Get the names of the formats supported by the javax.imageio package. There are typically multiple names corresponding to the same MIME type.- Returns:
- an unmodifiable set containing the names
-
getMimeTypes
Get the MIME types of the image types supported by the javax.imageio package.- Returns:
- an unmodifiable set containing the MIME types
-