APIdia Launch Partner
Top Description Fields Constructors Methods
javax.imageio.spi

public abstract Class ImageReaderWriterSpi

extends IIOServiceProvider
Class Inheritance
Known Direct Subclasses
javax.imageio.spi.ImageWriterSpi, javax.imageio.spi.ImageReaderSpi
Imports
java.lang.reflect.Method, javax.imageio.metadata.IIOMetadata, .IIOMetadataFormat, .IIOMetadataFormatImpl

A superclass containing instance variables and methods common to ImageReaderSpi and ImageWriterSpi.
See Also
IIORegistry, ImageReaderSpi, ImageWriterSpi

Field Summary

Modifier and TypeField and Description
protected String[]
extraImageMetadataFormatClassNames

An array of Strings containing the class names of any additional image metadata formats supported by this plug-in, initially null.

protected String[]
extraImageMetadataFormatNames

An array of Strings containing the names of any additional image metadata formats supported by this plug-in, initially null.

protected String[]
extraStreamMetadataFormatClassNames

An array of Strings containing the class names of any additional stream metadata formats supported by this plug-in, initially null.

protected String[]
extraStreamMetadataFormatNames

An array of Strings 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.

Inherited from javax.imageio.spi.IIOServiceProvider:
vendorNameversion

Constructor Summary

AccessConstructor and Description
public
ImageReaderWriterSpi(String
the vendor name, as a non-null String.
vendorName
,
String
a version identifier, as a non-null String.
version
,
String[]
a non-null array of Strings indicating the format names. At least one entry must be present.
names
,
String[]
an array of Strings indicating the common file suffixes. If no suffixes are defined, null should be supplied. An array of length 0 will be normalized to null.
suffixes
,
String[]
an array of Strings indicating the format's MIME types. If no MIME types are defined, null should be supplied. An array of length 0 will be normalized to null.
MIMETypes
,
String
the fully-qualified name of the associated ImageReader or ImageWriter class, as a non-null String.
pluginClassName
,
boolean
a boolean that indicates whether a stream metadata object can use trees described by the standard metadata format.
supportsStandardStreamMetadataFormat
,
String
a String, or null, to be returned from getNativeStreamMetadataFormatName.
nativeStreamMetadataFormatName
,
String
a String, or null, to be used to instantiate a metadata format object to be returned from getNativeStreamMetadataFormat.
nativeStreamMetadataFormatClassName
,
String[]
an array of Strings, or null, to be returned from getExtraStreamMetadataFormatNames. An array of length 0 is normalized to null.
extraStreamMetadataFormatNames
,
String[]
an array of Strings, or null, to be used to instantiate a metadata format object to be returned from getStreamMetadataFormat. An array of length 0 is normalized to null.
extraStreamMetadataFormatClassNames
,
boolean
a boolean that indicates whether an image metadata object can use trees described by the standard metadata format.
supportsStandardImageMetadataFormat
,
String
a String, or null, to be returned from getNativeImageMetadataFormatName.
nativeImageMetadataFormatName
,
String
a String, or null, to be used to instantiate a metadata format object to be returned from getNativeImageMetadataFormat.
nativeImageMetadataFormatClassName
,
String[]
an array of Strings to be returned from getExtraImageMetadataFormatNames. An array of length 0 is normalized to null.
extraImageMetadataFormatNames
,
String[]
an array of Strings, or null, to be used to instantiate a metadata format object to be returned from getImageMetadataFormat. An array of length 0 is normalized to null.
extraImageMetadataFormatClassNames
)

Constructs an ImageReaderWriterSpi with a given set of values.

public
ImageReaderWriterSpi()

Constructs a blank ImageReaderWriterSpi.

Method Summary

Modifier and TypeMethod and Description
public String[]

Returns:

an array of Strings, or null.
getExtraImageMetadataFormatNames
()

Returns an array of Strings 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.

public String[]

Returns:

an array of Strings, or null.
getExtraStreamMetadataFormatNames
()

Returns an array of Strings 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.

public String[]

Returns:

an array of Strings or length at least 1 containing common file suffixes associated with this reader or writer, or null.
getFileSuffixes
()

Returns an array of Strings 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.

public String[]

Returns:

a non-null array of Strings or length at least 1 containing informal format names associated with this reader or writer.
getFormatNames
()

Returns an array of Strings containing human-readable names for the formats that are generally usable by the ImageReader or ImageWriter implementation associated with this service provider.

public IIOMetadataFormat

Returns:

an IIOMetadataFormat object.
getImageMetadataFormat
(String
the desired image metadata format.
formatName
)

Returns an IIOMetadataFormat object describing the given image metadata format, or null if no description is available.

private IIOMetadataFormat
getMetadataFormat(String formatName, boolean supportsStandard, String nativeName, String nativeClassName, String[] extraNames, String[] extraClassNames)

private Class<?>
getMetadataFormatClass(String formatClassName)

public String[]

Returns:

an array of Strings or length at least 1 containing MIME types associated with this reader or writer, or null.
getMIMETypes
()

Returns an array of Strings 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.

public String

Returns:

the name of the native image metadata format, or null.
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, null will be returned.

public String

Returns:

the name of the native stream metadata format, or null.
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, null will be returned.

public String

Returns:

the class name, as a non-null String.
getPluginClassName
()

Returns the fully-qualified class name of the ImageReader or ImageWriter plug-in associated with this service provider.

public IIOMetadataFormat

Returns:

an IIOMetadataFormat object.
getStreamMetadataFormat
(String
the desired stream metadata format.
formatName
)

Returns an IIOMetadataFormat object describing the given stream metadata format, or null if no description is available.

public boolean

Returns:

true if the standard format is supported for image metadata.
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.

public boolean

Returns:

true if the standard format is supported for stream metadata.
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.

Inherited from javax.imageio.spi.IIOServiceProvider:
getDescriptiongetVendorNamegetVersiononDeregistrationonRegistration

Field Detail

extraImageMetadataFormatClassNamesback to summary
protected String[] extraImageMetadataFormatClassNames

An array of Strings containing the class names of any additional image metadata formats supported by this plug-in, initially null.

extraImageMetadataFormatNamesback to summary
protected String[] extraImageMetadataFormatNames

An array of Strings containing the names of any additional image metadata formats supported by this plug-in, initially null.

extraStreamMetadataFormatClassNamesback to summary
protected String[] extraStreamMetadataFormatClassNames

An array of Strings containing the class names of any additional stream metadata formats supported by this plug-in, initially null.

extraStreamMetadataFormatNamesback to summary
protected String[] extraStreamMetadataFormatNames

An array of Strings containing the names of any additional stream metadata formats supported by this plug-in, initially null.

MIMETypesback to summary
protected String[] MIMETypes

An array of strings to be returned from getMIMETypes, initially null.

namesback to summary
protected String[] names

An array of strings to be returned from getFormatNames, initially null. Constructors should set this to a non-null value.

nativeImageMetadataFormatClassNameback to summary
protected String nativeImageMetadataFormatClassName

A String containing the class name of the native stream metadata format supported by this plug-in, initially null.

nativeImageMetadataFormatNameback to summary
protected String nativeImageMetadataFormatName

A String containing the name of the native stream metadata format supported by this plug-in, initially null.

nativeStreamMetadataFormatClassNameback to summary
protected String nativeStreamMetadataFormatClassName

A String containing the class name of the native stream metadata format supported by this plug-in, initially null.

nativeStreamMetadataFormatNameback to summary
protected String nativeStreamMetadataFormatName

A String containing the name of the native stream metadata format supported by this plug-in, initially null.

pluginClassNameback to summary
protected String pluginClassName

A String containing the name of the associated plug-in class, initially null.

suffixesback to summary
protected String[] suffixes

An array of strings to be returned from getFileSuffixes, initially null.

supportsStandardImageMetadataFormatback to summary
protected boolean supportsStandardImageMetadataFormat

A boolean indicating whether this plug-in supports the standard metadata format for image metadata, initially false.

supportsStandardStreamMetadataFormatback to summary
protected boolean supportsStandardStreamMetadataFormat

A boolean indicating whether this plug-in supports the standard metadata format for stream metadata, initially false.

Constructor Detail

ImageReaderWriterSpiback to summary
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 an ImageReaderWriterSpi with a given set of values.

Parameters
vendorName:String

the vendor name, as a non-null String.

version:String

a version identifier, as a non-null String.

names:String[]

a non-null array of Strings indicating the format names. At least one entry must be present.

suffixes:String[]

an array of Strings indicating the common file suffixes. If no suffixes are defined, null should be supplied. An array of length 0 will be normalized to null.

MIMETypes:String[]

an array of Strings indicating the format's MIME types. If no MIME types are defined, null should be supplied. An array of length 0 will be normalized to null.

pluginClassName:String

the fully-qualified name of the associated ImageReader or ImageWriter class, as a non-null String.

supportsStandardStreamMetadataFormat:boolean

a boolean that indicates whether a stream metadata object can use trees described by the standard metadata format.

nativeStreamMetadataFormatName:String

a String, or null, to be returned from getNativeStreamMetadataFormatName.

nativeStreamMetadataFormatClassName:String

a String, or null, to be used to instantiate a metadata format object to be returned from getNativeStreamMetadataFormat.

extraStreamMetadataFormatNames:String[]

an array of Strings, or null, to be returned from getExtraStreamMetadataFormatNames. An array of length 0 is normalized to null.

extraStreamMetadataFormatClassNames:String[]

an array of Strings, or null, to be used to instantiate a metadata format object to be returned from getStreamMetadataFormat. An array of length 0 is normalized to null.

supportsStandardImageMetadataFormat:boolean

a boolean that indicates whether an image metadata object can use trees described by the standard metadata format.

nativeImageMetadataFormatName:String

a String, or null, to be returned from getNativeImageMetadataFormatName.

nativeImageMetadataFormatClassName:String

a String, or null, to be used to instantiate a metadata format object to be returned from getNativeImageMetadataFormat.

extraImageMetadataFormatNames:String[]

an array of Strings to be returned from getExtraImageMetadataFormatNames. An array of length 0 is normalized to null.

extraImageMetadataFormatClassNames:String[]

an array of Strings, or null, to be used to instantiate a metadata format object to be returned from getImageMetadataFormat. An array of length 0 is normalized to null.

Exceptions
IllegalArgumentException:
  • if vendorName is null.
  • if version is null.
  • if names is null or has length 0.
  • if pluginClassName is null.
ImageReaderWriterSpiback to summary
public ImageReaderWriterSpi()

Constructs a blank 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 Detail

getExtraImageMetadataFormatNamesback to summary
public String[] getExtraImageMetadataFormatNames()

Returns an array of Strings 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:String[]

an array of Strings, or null.

See Also
IIOMetadata#getMetadataFormatNames, getExtraStreamMetadataFormatNames, getNativeImageMetadataFormatName
getExtraStreamMetadataFormatNamesback to summary
public String[] getExtraStreamMetadataFormatNames()

Returns an array of Strings 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:String[]

an array of Strings, or null.

See Also
IIOMetadata#getMetadataFormatNames, getExtraImageMetadataFormatNames, getNativeStreamMetadataFormatName
getFileSuffixesback to summary
public String[] getFileSuffixes()

Returns an array of Strings 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:String[]

an array of Strings or length at least 1 containing common file suffixes associated with this reader or writer, or null.

getFormatNamesback to summary
public String[] getFormatNames()

Returns an array of Strings 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:String[]

a non-null array of Strings or length at least 1 containing informal format names associated with this reader or writer.

getImageMetadataFormatback to summary
public IIOMetadataFormat getImageMetadataFormat(String formatName)

Returns an 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:String

the desired image metadata format.

Returns:IIOMetadataFormat

an IIOMetadataFormat object.

Exceptions
IllegalArgumentException:
if formatName is null or is not a supported name.
getMetadataFormatback to summary
private IIOMetadataFormat getMetadataFormat(String formatName, boolean supportsStandard, String nativeName, String nativeClassName, String[] extraNames, String[] extraClassNames)
getMetadataFormatClassback to summary
private Class<?> getMetadataFormatClass(String formatClassName)
getMIMETypesback to summary
public String[] getMIMETypes()

Returns an array of Strings 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:String[]

an array of Strings or length at least 1 containing MIME types associated with this reader or writer, or null.

getNativeImageMetadataFormatNameback to summary
public 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. If no such format is supported, null will be returned.

The default implementation returns the nativeImageMetadataFormatName instance variable, which is typically set by the constructor.

Returns:String

the name of the native image metadata format, or null.

See Also
getExtraImageMetadataFormatNames
getNativeStreamMetadataFormatNameback to summary
public 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. If no such format is supported, null will be returned.

The default implementation returns the nativeStreamMetadataFormatName instance variable, which is typically set by the constructor.

Returns:String

the name of the native stream metadata format, or null.

getPluginClassNameback to summary
public String getPluginClassName()

Returns the fully-qualified class name of the ImageReader or ImageWriter plug-in associated with this service provider.

Returns:String

the class name, as a non-null String.

getStreamMetadataFormatback to summary
public IIOMetadataFormat getStreamMetadataFormat(String formatName)

Returns an 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:String

the desired stream metadata format.

Returns:IIOMetadataFormat

an IIOMetadataFormat object.

Exceptions
IllegalArgumentException:
if formatName is null or is not a supported name.
isStandardImageMetadataFormatSupportedback to summary
public 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.

Returns:boolean

true if the standard format is supported for image metadata.

isStandardStreamMetadataFormatSupportedback to summary
public 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.

Returns:boolean

true if the standard format is supported for stream metadata.