Class ImageReaderWriterSpi
- All Implemented Interfaces:
RegisterableService
- Direct Known Subclasses:
ImageReaderSpi,ImageWriterSpi
ImageReaderSpi and ImageWriterSpi.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]An array ofStrings containing the class names of any additional image metadata formats supported by this plug-in, initiallynull.protected String[]An array ofStrings containing the names of any additional image metadata formats supported by this plug-in, initiallynull.protected String[]An array ofStrings containing the class names of any additional stream metadata formats supported by this plug-in, initiallynull.protected String[]An array ofStrings containing the names of any additional stream metadata formats supported by this plug-in, initiallynull.protected String[]An array of strings to be returned fromgetMIMETypes, initiallynull.protected String[]An array of strings to be returned fromgetFormatNames, initiallynull.protected StringAStringcontaining the class name of the native stream metadata format supported by this plug-in, initiallynull.protected StringAStringcontaining the name of the native stream metadata format supported by this plug-in, initiallynull.protected StringAStringcontaining the class name of the native stream metadata format supported by this plug-in, initiallynull.protected StringAStringcontaining the name of the native stream metadata format supported by this plug-in, initiallynull.protected StringAStringcontaining the name of the associated plug-in class, initiallynull.protected String[]An array of strings to be returned fromgetFileSuffixes, initiallynull.protected booleanA boolean indicating whether this plug-in supports the standard metadata format for image metadata, initiallyfalse.protected booleanA boolean indicating whether this plug-in supports the standard metadata format for stream metadata, initiallyfalse.Fields declared in class javax.imageio.spi.IIOServiceProvider
vendorName, version -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a blankImageReaderWriterSpi.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) Constructs anImageReaderWriterSpiwith a given set of values. -
Method Summary
Modifier and TypeMethodDescriptionString[]Returns an array ofStrings containing the names of additional document formats, other than the native and standard formats, recognized by thegetAsTreeandsetFromTreemethods on the image metadata objects produced or consumed by this plug-in.String[]Returns an array ofStrings containing the names of additional document formats, other than the native and standard formats, recognized by thegetAsTreeandsetFromTreemethods on the stream metadata objects produced or consumed by this plug-in.String[]Returns an array ofStrings containing a list of file suffixes associated with the formats that are generally usable by theImageReaderorImageWriterimplementation associated with this service provider.String[]Returns an array ofStrings containing human-readable names for the formats that are generally usable by theImageReaderorImageWriterimplementation associated with this service provider.getImageMetadataFormat(String formatName) Returns anIIOMetadataFormatobject describing the given image metadata format, ornullif no description is available.String[]Returns an array ofStrings containing a list of MIME types associated with the formats that are generally usable by theImageReaderorImageWriterimplementation associated with this service provider.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.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.Returns the fully-qualified class name of theImageReaderorImageWriterplug-in associated with this service provider.getStreamMetadataFormat(String formatName) Returns anIIOMetadataFormatobject describing the given stream metadata format, ornullif no description is available.booleanReturnstrueif the standard metadata format is among the document formats recognized by thegetAsTreeandsetFromTreemethods on the image metadata objects produced or consumed by this plug-in.booleanReturnstrueif the standard metadata format is among the document formats recognized by thegetAsTreeandsetFromTreemethods 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
An array of strings to be returned fromgetFormatNames, initiallynull. Constructors should set this to a non-nullvalue. -
suffixes
An array of strings to be returned fromgetFileSuffixes, initiallynull. -
MIMETypes
An array of strings to be returned fromgetMIMETypes, initiallynull. -
pluginClassName
AStringcontaining the name of the associated plug-in class, initiallynull. -
supportsStandardStreamMetadataFormat
protected boolean supportsStandardStreamMetadataFormatA boolean indicating whether this plug-in supports the standard metadata format for stream metadata, initiallyfalse. -
nativeStreamMetadataFormatName
AStringcontaining the name of the native stream metadata format supported by this plug-in, initiallynull. -
nativeStreamMetadataFormatClassName
AStringcontaining the class name of the native stream metadata format supported by this plug-in, initiallynull. -
extraStreamMetadataFormatNames
An array ofStrings containing the names of any additional stream metadata formats supported by this plug-in, initiallynull. -
extraStreamMetadataFormatClassNames
An array ofStrings containing the class names of any additional stream metadata formats supported by this plug-in, initiallynull. -
supportsStandardImageMetadataFormat
protected boolean supportsStandardImageMetadataFormatA boolean indicating whether this plug-in supports the standard metadata format for image metadata, initiallyfalse. -
nativeImageMetadataFormatName
AStringcontaining the name of the native stream metadata format supported by this plug-in, initiallynull. -
nativeImageMetadataFormatClassName
AStringcontaining the class name of the native stream metadata format supported by this plug-in, initiallynull. -
extraImageMetadataFormatNames
An array ofStrings containing the names of any additional image metadata formats supported by this plug-in, initiallynull. -
extraImageMetadataFormatClassNames
An array ofStrings containing the class names of any additional image metadata formats supported by this plug-in, initiallynull.
-
-
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) Constructs anImageReaderWriterSpiwith a given set of values.- Parameters:
vendorName- the vendor name, as a non-nullString.version- a version identifier, as a non-nullString.names- a non-nullarray ofStrings indicating the format names. At least one entry must be present.suffixes- an array ofStrings indicating the common file suffixes. If no suffixes are defined,nullshould be supplied. An array of length 0 will be normalized tonull.MIMETypes- an array ofStrings indicating the format's MIME types. If no MIME types are defined,nullshould be supplied. An array of length 0 will be normalized tonull.pluginClassName- the fully-qualified name of the associatedImageReaderorImageWriterclass, as a non-null String.supportsStandardStreamMetadataFormat- abooleanthat 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 ofStrings, ornull, to be returned fromgetExtraStreamMetadataFormatNames. An array of length 0 is normalized tonull.extraStreamMetadataFormatClassNames- an array ofStrings, ornull, to be used to instantiate a metadata format object to be returned fromgetStreamMetadataFormat. An array of length 0 is normalized tonull.supportsStandardImageMetadataFormat- abooleanthat 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 ofStrings to be returned fromgetExtraImageMetadataFormatNames. An array of length 0 is normalized tonull.extraImageMetadataFormatClassNames- an array ofStrings, ornull, to be used to instantiate a metadata format object to be returned fromgetImageMetadataFormat. An array of length 0 is normalized tonull.- Throws:
IllegalArgumentException- ifvendorNameisnull.IllegalArgumentException- ifversionisnull.IllegalArgumentException- ifnamesisnullor has length 0.IllegalArgumentException- ifpluginClassNameisnull.
-
ImageReaderWriterSpi
public ImageReaderWriterSpi()Constructs a blankImageReaderWriterSpi. 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
Returns an array ofStrings containing human-readable names for the formats that are generally usable by theImageReaderorImageWriterimplementation associated with this service provider. For example, a singleImageReadermight be able to process both PBM and PNM files.- Returns:
- a non-
nullarray ofStrings or length at least 1 containing informal format names associated with this reader or writer.
-
getFileSuffixes
Returns an array ofStrings containing a list of file suffixes associated with the formats that are generally usable by theImageReaderorImageWriterimplementation associated with this service provider. For example, a singleImageReadermight be able to process files with '.pbm' and '.pnm' suffixes, or both '.jpg' and '.jpeg' suffixes. If there are no known file suffixes,nullwill 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
Strings or length at least 1 containing common file suffixes associated with this reader or writer, ornull.
-
getMIMETypes
Returns an array ofStrings containing a list of MIME types associated with the formats that are generally usable by theImageReaderorImageWriterimplementation 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-pbmandimage/x-portable-bitmap. Some file formats have official MIME types but may sometimes be referred to using their previous unofficial designations, such asimage/x-pnginstead of the officialimage/png. Finally, a single service provider may be capable of parsing multiple distinct types from the MIME point of view, for exampleimage/x-xbitmapandimage/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
Strings or length at least 1 containing MIME types associated with this reader or writer, ornull.
-
getPluginClassName
Returns the fully-qualified class name of theImageReaderorImageWriterplug-in associated with this service provider.- Returns:
- the class name, as a non-
nullString.
-
isStandardStreamMetadataFormatSupported
public boolean isStandardStreamMetadataFormatSupported()Returnstrueif the standard metadata format is among the document formats recognized by thegetAsTreeandsetFromTreemethods on the stream metadata objects produced or consumed by this plug-in.- Returns:
trueif the standard format is supported for stream metadata.
-
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. If no such format is supported,nullwill be returned.The default implementation returns the
nativeStreamMetadataFormatNameinstance variable, which is typically set by the constructor.- Returns:
- the name of the native stream metadata format, or
null.
-
getExtraStreamMetadataFormatNames
Returns an array ofStrings containing the names of additional document formats, other than the native and standard formats, recognized by thegetAsTreeandsetFromTreemethods 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
extraStreamMetadataFormatNamesinstance variable, which is typically set by the constructor.- Returns:
- an array of
Strings, or null. - See Also:
-
isStandardImageMetadataFormatSupported
public boolean isStandardImageMetadataFormatSupported()Returnstrueif the standard metadata format is among the document formats recognized by thegetAsTreeandsetFromTreemethods on the image metadata objects produced or consumed by this plug-in.- Returns:
trueif the standard format is supported for image metadata.
-
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. If no such format is supported,nullwill be returned.The default implementation returns the
nativeImageMetadataFormatNameinstance variable, which is typically set by the constructor.- Returns:
- the name of the native image metadata format, or
null. - See Also:
-
getExtraImageMetadataFormatNames
Returns an array ofStrings containing the names of additional document formats, other than the native and standard formats, recognized by thegetAsTreeandsetFromTreemethods 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
extraImageMetadataFormatNamesinstance variable, which is typically set by the constructor.- Returns:
- an array of
Strings, or null. - See Also:
-
getStreamMetadataFormat
Returns anIIOMetadataFormatobject describing the given stream metadata format, ornullif 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 bygetExtraStreamMetadataFormatNames.- Parameters:
formatName- the desired stream metadata format.- Returns:
- an
IIOMetadataFormatobject. - Throws:
IllegalArgumentException- ifformatNameisnullor is not a supported name.
-
getImageMetadataFormat
Returns anIIOMetadataFormatobject describing the given image metadata format, ornullif 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 bygetExtraImageMetadataFormatNames.- Parameters:
formatName- the desired image metadata format.- Returns:
- an
IIOMetadataFormatobject. - Throws:
IllegalArgumentException- ifformatNameisnullor is not a supported name.
-