Package com.iizix.image
Enum Class ImageType
- All Implemented Interfaces:
- Serializable,- Comparable<ImageType>,- Constable
The image selected by a user type enumeration. The APNG, JPEG2000 and HEIC/HEIF image file formats are not supported.
- Author:
- Christopher Mindus
- Nested Class Summary- Nested classes/interfaces inherited from class java.lang.Enum- Enum.EnumDesc<E extends Enum<E>>
- Enum Constant SummaryEnum ConstantsEnum ConstantDescriptionThe- ALL_IMAGESimage type has the media type "image/*", and the file extension set to "*".BMP: "image/bmp", extension ".bmp".GIF: "image/gif", extension ".gif".JPEG: "image/jpeg", extensions ".jpg,.jpeg,.jpe,.jif,.jfif,.jfi".PNG: "image/png", extension ".png" (no support for "Animated PNG" a.k.a.SVG: "image/svg+xml", extension ".svg" or GZip compressed (much like ".svg.gz") ".svgz".TIFF: "image/tiff", extensions ".tif,.tiff".Unknown or currently unsupported image type, Strings for media type and extension are- null.WBMP: "image/vnd.wap.wbmp", extension ".wbmp".WebP: "media/webp", extension ".webp".
- Field SummaryFieldsModifier and TypeFieldDescription- final StringThe common file extensions for this image media type, in lower case.The file extensions without leading "dot" as an unmodifiable collection.- final StringThe first and most common file extension starting with '.' if not- ALL_IMAGESotherwise '*' for {link #ALL_IMAGES} or- nullfor- UNKNOWN.- final booleanFlag for bitmap type (valid and non-vector formats except- ALL_IMAGESis- true).- final booleanFlag for defined image type, i.e.- final StringThe media type, or- nullfor- {@link #UNKNOWN}.
- Method SummaryModifier and TypeMethodDescription- static ImageType- fromExtension- (String extension) Finds the image type for a file extension.- static ImageType- fromMediaType- (String mediaType) Finds the image type from the "image/..." string.- static ImageTypeReturns the enum constant of this class with the specified name.- static ImageType[]- values()Returns an array containing the constants of this enum class, in the order they are declared.
- Enum Constant Details- UNKNOWNUnknown or currently unsupported image type, Strings for media type and extension are- null.
- ALL_IMAGESThe- ALL_IMAGESimage type has the media type "image/*", and the file extension set to "*".
- PNGPNG: "image/png", extension ".png" (no support for "Animated PNG" a.k.a. "APNG" with file extension ".apng").
- JPEGJPEG: "image/jpeg", extensions ".jpg,.jpeg,.jpe,.jif,.jfif,.jfi".
- GIFGIF: "image/gif", extension ".gif".
- WEBPWebP: "media/webp", extension ".webp".
- TIFFTIFF: "image/tiff", extensions ".tif,.tiff".
- BMPBMP: "image/bmp", extension ".bmp".
- WBMPWBMP: "image/vnd.wap.wbmp", extension ".wbmp".
- SVGSVG: "image/svg+xml", extension ".svg" or GZip compressed (much like ".svg.gz") ".svgz".
 
- Field Details- isValidExtensionpublic final boolean isValidExtensionFlag for defined image type, i.e. not- {@link #UNKNOWN}or- {@link #ALL_IMAGES}.
- mediaTypeThe media type, or- nullfor- {@link #UNKNOWN}.
- extensionsThe common file extensions for this image media type, in lower case.- It is a comma separated string of file extensions, including the "dot". - It is - "*"for- {@link #ALL_IMAGES}image media type.- It is - nullfor- {@link #UNKNOWN}image media type.
- firstExtensionThe first and most common file extension starting with '.' if not- ALL_IMAGESotherwise '*' for {link #ALL_IMAGES} or- nullfor- UNKNOWN.
- extensionsNoDotThe file extensions without leading "dot" as an unmodifiable collection. Note: the ordering of the original extensions is kept.
- isBitmappublic final boolean isBitmapFlag for bitmap type (valid and non-vector formats except- ALL_IMAGESis- true).
 
- Method Details- valuesReturns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
 
- valueOfReturns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
- name- the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
- IllegalArgumentException- if this enum class has no constant with the specified name
- NullPointerException- if the argument is null
 
- fromExtensionFinds the image type for a file extension.- Parameters:
- extension- File extension with or without a dot, case insensitive.
- Returns:
- The media type, or nullif not found. Note that{@link #ALL_IMAGES}is returned if theextensionis equal to"*"(asterisk) or".*"(dot-asterisk).
 
- fromMediaTypeFinds the image type from the "image/..." string.- Parameters:
- mediaType- The media type (case sensitive).
- Returns:
- The media type, or nullif not found. Note that{@link #ALL_IMAGES}is returned if themediaTypeis equal to"image/*".