Class ImageReaderWriterSpi
- All Implemented Interfaces:
RegisterableService
- Direct Known Subclasses:
-
ImageReaderSpi
,ImageWriterSpi
public abstract class ImageReaderWriterSpi extends IIOServiceProvider
ImageReaderSpi
and ImageWriterSpi
.- See Also:
Field Summary
Modifier and Type | Field | Description |
---|---|---|
protected String[] |
extraImageMetadataFormatClassNames |
An array of String s containing the class names of any additional image metadata formats supported by this plug-in, initially null . |
protected String[] |
extraImageMetadataFormatNames |
An array of String s containing the names of any additional image metadata formats supported by this plug-in, initially null . |
protected String[] |
extraStreamMetadataFormatClassNames |
An array of String s containing the class names of any additional stream metadata formats supported by this plug-in, initially null . |
protected String[] |
extraStreamMetadataFormatNames |
An array of String s containing the names of any additional stream metadata formats supported by this plug-in, initially null . |
protected String[] |
MIMETypes |
An array of strings to be returned from getMIMETypes , initially null . |
protected String[] |
names |
An array of strings to be returned from getFormatNames , initially null . |
protected String |
nativeImageMetadataFormatClassName |
A String containing the class name of the native stream metadata format supported by this plug-in, initially null . |
protected String |
nativeImageMetadataFormatName |
A String containing the name of the native stream metadata format supported by this plug-in, initially null . |
protected String |
nativeStreamMetadataFormatClassName |
A String containing the class name of the native stream metadata format supported by this plug-in, initially null . |
protected String |
nativeStreamMetadataFormatName |
A String containing the name of the native stream metadata format supported by this plug-in, initially null . |
protected String |
pluginClassName |
A String containing the name of the associated plug-in class, initially null . |
protected String[] |
suffixes |
An array of strings to be returned from getFileSuffixes , initially null . |
protected boolean |
supportsStandardImageMetadataFormat |
A boolean indicating whether this plug-in supports the standard metadata format for image metadata, initially false . |
protected boolean |
supportsStandardStreamMetadataFormat |
A boolean indicating whether this plug-in supports the standard metadata format for stream metadata, initially false . |
Fields declared in class javax.imageio.spi.IIOServiceProvider
vendorName, version
Constructor Summary
Constructor | Description |
---|---|
ImageReaderWriterSpi() |
Constructs a blank ImageReaderWriterSpi . |
ImageReaderWriterSpi |
Constructs an ImageReaderWriterSpi with a given set of values. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
String[] |
getExtraImageMetadataFormatNames() |
Returns an array of String s containing the names of additional document formats, other than the native and standard formats, recognized by the getAsTree and setFromTree methods on the image metadata objects produced or consumed by this plug-in. |
String[] |
getExtraStreamMetadataFormatNames() |
Returns an array of String s containing the names of additional document formats, other than the native and standard formats, recognized by the getAsTree and setFromTree methods on the stream metadata objects produced or consumed by this plug-in. |
String[] |
getFileSuffixes() |
Returns an array of String s containing a list of file suffixes associated with the formats that are generally usable by the ImageReader or ImageWriter implementation associated with this service provider. |
String[] |
getFormatNames() |
Returns an array of String s containing human-readable names for the formats that are generally usable by the ImageReader or ImageWriter implementation associated with this service provider. |
IIOMetadataFormat |
getImageMetadataFormat |
Returns an IIOMetadataFormat object describing the given image metadata format, or null if no description is available. |
String[] |
getMIMETypes() |
Returns an array of String s containing a list of MIME types associated with the formats that are generally usable by the ImageReader or ImageWriter implementation associated with this service provider. |
String |
getNativeImageMetadataFormatName() |
Returns the name of the "native" image metadata format for this plug-in, which typically allows for lossless encoding and transmission of the image metadata stored in the format handled by this plug-in. |
String |
getNativeStreamMetadataFormatName() |
Returns the name of the "native" stream metadata format for this plug-in, which typically allows for lossless encoding and transmission of the stream metadata stored in the format handled by this plug-in. |
String |
getPluginClassName() |
Returns the fully-qualified class name of the ImageReader or ImageWriter plug-in associated with this service provider. |
IIOMetadataFormat |
getStreamMetadataFormat |
Returns an IIOMetadataFormat object describing the given stream metadata format, or null if no description is available. |
boolean |
isStandardImageMetadataFormatSupported() |
Returns true if the standard metadata format is among the document formats recognized by the getAsTree and setFromTree methods on the image metadata objects produced or consumed by this plug-in. |
boolean |
isStandardStreamMetadataFormatSupported() |
Returns true if the standard metadata format is among the document formats recognized by the getAsTree and setFromTree methods on the stream metadata objects produced or consumed by this plug-in. |
Methods declared in class javax.imageio.spi.IIOServiceProvider
getDescription, getVendorName, getVersion, onDeregistration, onRegistration
Field Details
names
protected String[] names
getFormatNames
, initially null
. Constructors should set this to a non-null
value.suffixes
protected String[] suffixes
getFileSuffixes
, initially null
.MIMETypes
protected String[] MIMETypes
getMIMETypes
, initially null
.pluginClassName
protected String pluginClassName
String
containing the name of the associated plug-in class, initially null
.supportsStandardStreamMetadataFormat
protected boolean supportsStandardStreamMetadataFormat
false
.nativeStreamMetadataFormatName
protected String nativeStreamMetadataFormatName
String
containing the name of the native stream metadata format supported by this plug-in, initially null
.nativeStreamMetadataFormatClassName
protected String nativeStreamMetadataFormatClassName
String
containing the class name of the native stream metadata format supported by this plug-in, initially null
.extraStreamMetadataFormatNames
protected String[] extraStreamMetadataFormatNames
String
s containing the names of any additional stream metadata formats supported by this plug-in, initially null
.extraStreamMetadataFormatClassNames
protected String[] extraStreamMetadataFormatClassNames
String
s containing the class names of any additional stream metadata formats supported by this plug-in, initially null
.supportsStandardImageMetadataFormat
protected boolean supportsStandardImageMetadataFormat
false
.nativeImageMetadataFormatName
protected String nativeImageMetadataFormatName
String
containing the name of the native stream metadata format supported by this plug-in, initially null
.nativeImageMetadataFormatClassName
protected String nativeImageMetadataFormatClassName
String
containing the class name of the native stream metadata format supported by this plug-in, initially null
.extraImageMetadataFormatNames
protected String[] extraImageMetadataFormatNames
String
s containing the names of any additional image metadata formats supported by this plug-in, initially null
.extraImageMetadataFormatClassNames
protected String[] extraImageMetadataFormatClassNames
String
s containing the class names of any additional image metadata formats supported by this plug-in, initially null
.Constructor Details
ImageReaderWriterSpi
public ImageReaderWriterSpi(String vendorName, String version, String[] names, String[] suffixes, String[] MIMETypes, String pluginClassName, boolean supportsStandardStreamMetadataFormat, String nativeStreamMetadataFormatName, String nativeStreamMetadataFormatClassName, String[] extraStreamMetadataFormatNames, String[] extraStreamMetadataFormatClassNames, boolean supportsStandardImageMetadataFormat, String nativeImageMetadataFormatName, String nativeImageMetadataFormatClassName, String[] extraImageMetadataFormatNames, String[] extraImageMetadataFormatClassNames)
ImageReaderWriterSpi
with a given set of values.- Parameters:
-
vendorName
- the vendor name, as a non-null
String
. -
version
- a version identifier, as a non-null
String
. -
names
- a non-null
array ofString
s indicating the format names. At least one entry must be present. -
suffixes
- an array ofString
s indicating the common file suffixes. If no suffixes are defined,null
should be supplied. An array of length 0 will be normalized tonull
. -
MIMETypes
- an array ofString
s indicating the format's MIME types. If no MIME types are defined,null
should be supplied. An array of length 0 will be normalized tonull
. -
pluginClassName
- the fully-qualified name of the associatedImageReader
orImageWriter
class, as a non-null String
. -
supportsStandardStreamMetadataFormat
- aboolean
that indicates whether a stream metadata object can use trees described by the standard metadata format. -
nativeStreamMetadataFormatName
- aString
, ornull
, to be returned fromgetNativeStreamMetadataFormatName
. -
nativeStreamMetadataFormatClassName
- aString
, ornull
, to be used to instantiate a metadata format object to be returned fromgetNativeStreamMetadataFormat
. -
extraStreamMetadataFormatNames
- an array ofString
s, ornull
, to be returned fromgetExtraStreamMetadataFormatNames
. An array of length 0 is normalized tonull
. -
extraStreamMetadataFormatClassNames
- an array ofString
s, ornull
, to be used to instantiate a metadata format object to be returned fromgetStreamMetadataFormat
. An array of length 0 is normalized tonull
. -
supportsStandardImageMetadataFormat
- aboolean
that indicates whether an image metadata object can use trees described by the standard metadata format. -
nativeImageMetadataFormatName
- aString
, ornull
, to be returned fromgetNativeImageMetadataFormatName
. -
nativeImageMetadataFormatClassName
- aString
, ornull
, to be used to instantiate a metadata format object to be returned fromgetNativeImageMetadataFormat
. -
extraImageMetadataFormatNames
- an array ofString
s to be returned fromgetExtraImageMetadataFormatNames
. An array of length 0 is normalized tonull
. -
extraImageMetadataFormatClassNames
- an array ofString
s, ornull
, to be used to instantiate a metadata format object to be returned fromgetImageMetadataFormat
. An array of length 0 is normalized tonull
. - Throws:
-
IllegalArgumentException
- ifvendorName
isnull
. -
IllegalArgumentException
- ifversion
isnull
. -
IllegalArgumentException
- ifnames
isnull
or has length 0. -
IllegalArgumentException
- ifpluginClassName
isnull
.
ImageReaderWriterSpi
public ImageReaderWriterSpi()
ImageReaderWriterSpi
. It is up to the subclass to initialize instance variables and/or override method implementations in order to provide working versions of all methods.Method Details
getFormatNames
public String[] getFormatNames()
String
s containing human-readable names for the formats that are generally usable by the ImageReader
or ImageWriter
implementation associated with this service provider. For example, a single ImageReader
might be able to process both PBM and PNM files.- Returns:
- a non-
null
array ofString
s or length at least 1 containing informal format names associated with this reader or writer.
getFileSuffixes
public String[] getFileSuffixes()
String
s containing a list of file suffixes associated with the formats that are generally usable by the ImageReader
or ImageWriter
implementation associated with this service provider. For example, a single ImageReader
might be able to process files with '.pbm' and '.pnm' suffixes, or both '.jpg' and '.jpeg' suffixes. If there are no known file suffixes, null
will be returned. Returning a particular suffix does not guarantee that files with that suffix can be processed; it merely indicates that it may be worthwhile attempting to decode or encode such files using this service provider.
- Returns:
- an array of
String
s or length at least 1 containing common file suffixes associated with this reader or writer, ornull
.
getMIMETypes
public String[] getMIMETypes()
String
s containing a list of MIME types associated with the formats that are generally usable by the ImageReader
or ImageWriter
implementation associated with this service provider. Ideally, only a single MIME type would be required in order to describe a particular format. However, for several reasons it is necessary to associate a list of types with each service provider. First, many common image file formats do not have standard MIME types, so a list of commonly used unofficial names will be required, such as image/x-pbm
and image/x-portable-bitmap
. Some file formats have official MIME types but may sometimes be referred to using their previous unofficial designations, such as image/x-png
instead of the official image/png
. Finally, a single service provider may be capable of parsing multiple distinct types from the MIME point of view, for example image/x-xbitmap
and image/x-xpixmap
.
Returning a particular MIME type does not guarantee that files claiming to be of that type can be processed; it merely indicates that it may be worthwhile attempting to decode or encode such files using this service provider.
- Returns:
- an array of
String
s or length at least 1 containing MIME types associated with this reader or writer, ornull
.
getPluginClassName
public String getPluginClassName()
ImageReader
or ImageWriter
plug-in associated with this service provider.- Returns:
- the class name, as a non-
null
String
.
isStandardStreamMetadataFormatSupported
public boolean isStandardStreamMetadataFormatSupported()
true
if the standard metadata format is among the document formats recognized by the getAsTree
and setFromTree
methods on the stream metadata objects produced or consumed by this plug-in.- Returns:
-
true
if the standard format is supported for stream metadata.
getNativeStreamMetadataFormatName
public String getNativeStreamMetadataFormatName()
null
will be returned. The default implementation returns the nativeStreamMetadataFormatName
instance variable, which is typically set by the constructor.
- Returns:
- the name of the native stream metadata format, or
null
.
getExtraStreamMetadataFormatNames
public String[] getExtraStreamMetadataFormatNames()
String
s containing the names of additional document formats, other than the native and standard formats, recognized by the getAsTree
and setFromTree
methods on the stream metadata objects produced or consumed by this plug-in. If the plug-in does not handle metadata, null should be returned.
The set of formats may differ according to the particular images being read or written; this method should indicate all the additional formats supported by the plug-in under any circumstances.
The default implementation returns a clone of the extraStreamMetadataFormatNames
instance variable, which is typically set by the constructor.
- Returns:
- an array of
String
s, or null. - See Also:
isStandardImageMetadataFormatSupported
public boolean isStandardImageMetadataFormatSupported()
true
if the standard metadata format is among the document formats recognized by the getAsTree
and setFromTree
methods on the image metadata objects produced or consumed by this plug-in.- Returns:
-
true
if the standard format is supported for image metadata.
getNativeImageMetadataFormatName
public String getNativeImageMetadataFormatName()
null
will be returned. The default implementation returns the nativeImageMetadataFormatName
instance variable, which is typically set by the constructor.
- Returns:
- the name of the native image metadata format, or
null
. - See Also:
getExtraImageMetadataFormatNames
public String[] getExtraImageMetadataFormatNames()
String
s containing the names of additional document formats, other than the native and standard formats, recognized by the getAsTree
and setFromTree
methods on the image metadata objects produced or consumed by this plug-in. If the plug-in does not handle image metadata, null should be returned.
The set of formats may differ according to the particular images being read or written; this method should indicate all the additional formats supported by the plug-in under any circumstances.
The default implementation returns a clone of the extraImageMetadataFormatNames
instance variable, which is typically set by the constructor.
- Returns:
- an array of
String
s, or null. - See Also:
getStreamMetadataFormat
public IIOMetadataFormat getStreamMetadataFormat(String formatName)
IIOMetadataFormat
object describing the given stream metadata format, or null
if no description is available. The supplied name must be the native stream metadata format name, the standard metadata format name, or one of those returned by getExtraStreamMetadataFormatNames
.- Parameters:
-
formatName
- the desired stream metadata format. - Returns:
- an
IIOMetadataFormat
object. - Throws:
-
IllegalArgumentException
- ifformatName
isnull
or is not a supported name.
getImageMetadataFormat
public IIOMetadataFormat getImageMetadataFormat(String formatName)
IIOMetadataFormat
object describing the given image metadata format, or null
if no description is available. The supplied name must be the native image metadata format name, the standard metadata format name, or one of those returned by getExtraImageMetadataFormatNames
.- Parameters:
-
formatName
- the desired image metadata format. - Returns:
- an
IIOMetadataFormat
object. - Throws:
-
IllegalArgumentException
- ifformatName
isnull
or is not a supported name.
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/imageio/spi/ImageReaderWriterSpi.html