|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectIIOServiceProvider
ImageReaderWriterSpi
ImageWriterSpi
SpatialImageWriter.Spi
ImageWriterAdapter.Spi
public abstract static class ImageWriterAdapter.Spi
Service provider interface (SPI) for ImageWriterAdapters. The constructor of this
class initializes the ImageWriterSpi.outputTypes field to types that can represent
a filename, like File or URL, rather than the usual
standard output type. The names and
MIMETypes fields are set to the values of the wrapped provider,
suffixed with the string given at construction time.
Example: An ImageWriterAdapter wrapping the "tiff" image writer
with the "-wf" suffix will have the "tiff-wf" format name and the
"image/x-tiff-wf" MIME type.
The table below summarizes the initial values. Those values can be modified by subclass constructors.
| Field | Value |
|---|---|
ImageReaderWriterSpi.names |
Same values than the main provider, suffixed by the given string. |
ImageReaderWriterSpi.suffixes |
Same values than the main provider. |
ImageReaderWriterSpi.MIMETypes |
Same values than the main provider, suffixed by the given string. |
ImageWriterAdapter.outputTypes |
String, File, URI, URL,
ImageOutputStream |
It is up to subclass constructors to initialize all other instance variables in order to provide working versions of every methods.
ImageReaderAdapter.Spi
| coverage/geotk-coverageio (download) | View source code for this class |
| Field Summary | |
|---|---|
protected ImageWriterSpi |
main
The provider of the writers to use for writing the pixel values. |
| Fields inherited from class ImageWriterSpi |
|---|
outputTypes, readerSpiNames, STANDARD_OUTPUT_TYPE |
| Fields inherited from class IIOServiceProvider |
|---|
vendorName, version |
| Constructor Summary | |
|---|---|
protected |
ImageWriterAdapter.Spi(ImageWriterSpi main)
Deprecated. Specify a suffix. |
protected |
ImageWriterAdapter.Spi(ImageWriterSpi main,
String formatNameSuffix)
Creates an ImageWriterAdapter.Spi wrapping the given provider. |
protected |
ImageWriterAdapter.Spi(String format)
Deprecated. Specify a suffix. |
protected |
ImageWriterAdapter.Spi(String format,
String suffix)
Creates a provider which will use the given format for writing pixel values. |
| Method Summary | |
|---|---|
boolean |
canEncodeImage(ImageTypeSpecifier type)
Returns true if the writer implementation associated with this service provider
is able to encode an image with the given layout. |
boolean |
canEncodeImage(RenderedImage image)
Returns true if the writer implementation associated with this service provider
is able to encode the given image. |
IIOMetadataFormat |
getImageMetadataFormat(String formatName)
Returns a description of the image metadata of the given name. |
Set<InformationType> |
getModifiedInformation(ImageTypeSpecifier type)
Returns the kind of information that this wrapper will add or modify compared to the main writer. |
IIOMetadataFormat |
getStreamMetadataFormat(String formatName)
Returns a description of the stream metadata of the given name. |
boolean |
isFormatLossless()
Returns true if the format that this writer outputs preserves pixel data
bit-accurately. |
void |
onRegistration(ServiceRegistry registry,
Class<?> category)
A callback that will be called exactly once after the Spi class has been
instantiated and registered in a ServiceRegistry. |
static ImageWriterSpi |
unwrap(ImageWriterSpi spi)
If the given provider is an instance of ImageWriterAdapter.Spi, returns the
underlying main provider. |
| Methods inherited from class ImageWriterSpi |
|---|
createWriterInstance, createWriterInstance, getImageReaderSpiNames, getOutputTypes, isOwnWriter |
| Methods inherited from class IIOServiceProvider |
|---|
getDescription, getVendorName, getVersion, onDeregistration |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final ImageWriterSpi main
| Constructor Detail |
|---|
@Deprecated protected ImageWriterAdapter.Spi(ImageWriterSpi main)
@Deprecated protected ImageWriterAdapter.Spi(String format)
protected ImageWriterAdapter.Spi(ImageWriterSpi main,
String formatNameSuffix)
ImageWriterAdapter.Spi wrapping the given provider. The fields are
initialized as documented in the class javadoc. It is up
to the subclass to initialize all other instance variables in order to provide working
versions of all methods.
For efficiency reasons, the outputTypes field is initialized to a shared array.
Subclasses can assign new arrays, but should not modify the default array content.
main - The provider of the writers to use for writing the pixel values.formatNameSuffix - The suffix to append to format names and MIME types.
protected ImageWriterAdapter.Spi(String format,
String suffix)
throws IllegalArgumentException
format - The name of the provider to use for writing the pixel values.suffix - The suffix to append to format names and
MIME types.
IllegalArgumentException - If no provider is found for the given format.| Method Detail |
|---|
public IIOMetadataFormat getStreamMetadataFormat(String formatName)
null.
getStreamMetadataFormat in class SpatialImageWriter.SpiformatName - The desired stream metadata format.
public IIOMetadataFormat getImageMetadataFormat(String formatName)
null.
getImageMetadataFormat in class SpatialImageWriter.SpiformatName - The desired image metadata format.
public boolean isFormatLossless()
true if the format that this writer outputs preserves pixel data
bit-accurately. The default implementation delegates to the main
provider.
isFormatLossless in class ImageWriterSpipublic boolean canEncodeImage(ImageTypeSpecifier type)
true if the writer implementation associated with this service provider
is able to encode an image with the given layout. The default implementation delegates
to the main provider.
canEncodeImage in class ImageWriterSpitype - The layout of the image to be written.public boolean canEncodeImage(RenderedImage image)
true if the writer implementation associated with this service provider
is able to encode the given image. The default implementation delegates to the
main provider.
canEncodeImage in class ImageWriterSpiimage - The image to be written.public Set<InformationType> getModifiedInformation(ImageTypeSpecifier type)
The default implementation conservatively returns all of the InformationType
enum values. Subclasses should return more accurate information when possible.
type - The layout of the image to be written.
public void onRegistration(ServiceRegistry registry,
Class<?> category)
Spi class has been
instantiated and registered in a ServiceRegistry. The default implementation
conservatively gives precedence to the main provider, using the code
below:
The plugin order matter when an image writer is selected by file suffix, because the file suffixes of this adapter are the same than the file suffixes of the main provider by default.registry.setOrdering(category, main, this);
onRegistration in interface RegisterableServiceonRegistration in class IIOServiceProviderServiceRegistry.setOrdering(Class, Object, Object)public static ImageWriterSpi unwrap(ImageWriterSpi spi)
ImageWriterAdapter.Spi, returns the
underlying main provider. Otherwise returns the given provider unchanged.
This method is convenient when the caller is not interested in spatial metadata, in order to ensure that the cost of writing TFW, PRJ or similar files is avoided.
spi - An image writer provider, or null.
null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||