Enum FormatFilter
- All Implemented Interfaces:
Serializable
,Comparable<FormatFilter>
,java.lang.constant.Constable
Specify the property to use as a filtering criterion for choosing an image reader or writer.
This is used for providing utility methods about image formats.
- Since:
- 1.2
- Version:
- 1.2
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Function<ImageReaderWriterSpi,
String[]> The method to invoke for getting the property values (name, suffix or MIME type) to use for filtering.private static final Class<?>[]
Types of image inputs that are accepted byStorageConnector
.private static final Class<?>[]
Types of image outputs that are accepted byStorageConnector
. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
FormatFilter
(Function<ImageReaderWriterSpi, String[]> property) Creates a new enumeration value. -
Method Summary
Modifier and TypeMethodDescription(package private) final ImageReader
createReader
(String identifier, FormatFinder format, Map<ImageReaderSpi, Boolean> deferred) Creates a new reader for the given input.(package private) final ImageWriter
createWriter
(String identifier, FormatFinder format, RenderedImage image, Map<ImageWriterSpi, Boolean> deferred) Creates a new writer for the given output.(package private) final ImageReaderSpi
findProvider
(String identifier, StorageConnector connector, Set<ImageReaderSpi> done) Finds a provider for the given input, or returnsnull
if none.private <T extends ImageReaderWriterSpi>
Iterator<T>getServiceProviders
(Class<T> category, String identifier) Returns an iterator over all providers of the given category having the given name, suffix or MIME type.static FormatFilter
Returns the enum constant of this type with the specified name.static FormatFilter[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NAME
Filter the providers by format name. -
SUFFIX
Filter the providers by file extension. -
MIME
Filter the providers by MIME type.
-
-
Field Details
-
property
The method to invoke for getting the property values (name, suffix or MIME type) to use for filtering. -
VALID_INPUTS
Types of image inputs that are accepted byStorageConnector
. An input type is accepted if it is equal to one of those types. We do not useClass.isAssignableFrom(Class)
because if an image reader requests a sub-type, we can probably not provide it ourselves. -
VALID_OUTPUTS
Types of image outputs that are accepted byStorageConnector
. An output type is accepted if it is equal to one of those types. We do not useClass.isAssignableFrom(Class)
because if an image reader requests a sub-type, we can probably not provide it ourselves.
-
-
Constructor Details
-
FormatFilter
Creates a new enumeration value.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
getServiceProviders
private <T extends ImageReaderWriterSpi> Iterator<T> getServiceProviders(Class<T> category, String identifier) Returns an iterator over all providers of the given category having the given name, suffix or MIME type.- Type Parameters:
T
- the compile-time type of thecategory
argument.- Parameters:
category
- eitherImageReaderSpi
orImageWriterSpi
.identifier
- the property value to use as a filtering criterion, ornull
if none.- Returns:
- an iterator over the requested providers.
-
findProvider
final ImageReaderSpi findProvider(String identifier, StorageConnector connector, Set<ImageReaderSpi> done) throws IOException, DataStoreException Finds a provider for the given input, or returnsnull
if none. This is used byWorldFileStoreProvider.probeContent(StorageConnector)
.- Parameters:
identifier
- the property value to use as a filtering criterion, ornull
if none.connector
- provider of the input to be given to thecanDecodeInput(…)
method.done
- initially empty set to be populated with providers tested by this method.- Returns:
- the provider for the given input, or
null
if none was found. - Throws:
DataStoreException
- if an error occurred while opening a stream from the storage connector.IOException
- if an error occurred while creating the image reader instance.
-
createReader
final ImageReader createReader(String identifier, FormatFinder format, Map<ImageReaderSpi, Boolean> deferred) throws IOException, DataStoreExceptionCreates a new reader for the given input. Caller needs to invoke this method with an initially emptydeferred
map, which will be populated by this method. Providers associated toTRUE
should be tested again by the caller with anImageInputStream
created by the caller. This is intentionally not done automatically byStorageConnector
.- Parameters:
identifier
- the property value to use as a filtering criterion, ornull
if none.format
- provider of the input to be given to the new reader instance.deferred
- initially empty map to be populated with providers tested by this method.- Returns:
- the new image reader instance with its input initialized, or
null
if none was found. - Throws:
DataStoreException
- if an error occurred while opening a stream from the storage connector.IOException
- if an error occurred while creating the image reader instance.
-
createWriter
final ImageWriter createWriter(String identifier, FormatFinder format, RenderedImage image, Map<ImageWriterSpi, Boolean> deferred) throws IOException, DataStoreExceptionCreates a new writer for the given output. Caller needs to invoke this method with an initially emptydeferred
map, which will be populated by this method. Providers associated toTRUE
should be tested again by the caller with anImageOutputStream
created by the caller. This is intentionally not done automatically byStorageConnector
.- Parameters:
identifier
- the property value to use as a filtering criterion, ornull
if none.format
- provider of the output to be given to the new writer instance.image
- the image to write, ornull
if unknown.deferred
- initially empty map to be populated with providers tested by this method.- Returns:
- the new image writer instance with its output initialized, or
null
if none was found. - Throws:
DataStoreException
- if an error occurred while opening a stream from the storage connector.IOException
- if an error occurred while creating the image writer instance.
-