Java Doc for ImageWriterSpi.java in  » 6.0-JDK-Core » image » javax » imageio » spi » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » image » javax.imageio.spi 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.imageio.spi.IIOServiceProvider
      javax.imageio.spi.ImageReaderWriterSpi
         javax.imageio.spi.ImageWriterSpi

ImageWriterSpi
abstract public class ImageWriterSpi extends ImageReaderWriterSpi (Code)
The service provider interface (SPI) for ImageWriters. For more information on service provider classes, see the class comment for the IIORegistry class.

Each ImageWriterSpi provides several types of information about the ImageWriter class with which it is associated.

The name of the vendor who defined the SPI class and a brief description of the class are available via the getVendorName, getDescription, and getVersion methods. These methods may be internationalized to provide locale-specific output. These methods are intended mainly to provide short, human-writable information that might be used to organize a pop-up menu or other list.

Lists of format names, file suffixes, and MIME types associated with the service may be obtained by means of the getFormatNames, getFileSuffixes, and getMIMEType methods. These methods may be used to identify candidate ImageWriters for writing a particular file or stream based on manual format selection, file naming, or MIME associations.

A more reliable way to determine which ImageWriters are likely to be able to parse a particular data stream is provided by the canEncodeImage method. This methods allows the service provider to inspect the actual image contents.

Finally, an instance of the ImageWriter class associated with this service provider may be obtained by calling the createWriterInstance method. Any heavyweight initialization, such as the loading of native libraries or creation of large tables, should be deferred at least until the first invocation of this method.
See Also:   IIORegistry
See Also:   javax.imageio.ImageTypeSpecifier
See Also:   javax.imageio.ImageWriter
version:
   0.5



Field Summary
final public static  Class[]STANDARD_OUTPUT_TYPE
     A single-element array, initially containing ImageInputStream.class, to be returned from getInputTypes.
protected  Class[]outputTypes
     An array of Class objects to be returned from getOutputTypes, initially null.
protected  String[]readerSpiNames
     An array of strings to be returned from getImageReaderSpiNames, initially null.

Constructor Summary
protected  ImageWriterSpi()
     Constructs a blank ImageWriterSpi.
public  ImageWriterSpi(String vendorName, String version, String[] names, String[] suffixes, String[] MIMETypes, String writerClassName, Class[] outputTypes, String[] readerSpiNames, boolean supportsStandardStreamMetadataFormat, String nativeStreamMetadataFormatName, String nativeStreamMetadataFormatClassName, String[] extraStreamMetadataFormatNames, String[] extraStreamMetadataFormatClassNames, boolean supportsStandardImageMetadataFormat, String nativeImageMetadataFormatName, String nativeImageMetadataFormatClassName, String[] extraImageMetadataFormatNames, String[] extraImageMetadataFormatClassNames)
     Constructs an ImageWriterSpi with a given set of values.
Parameters:
  vendorName - the vendor name, as a non-nullString.
Parameters:
  version - a version identifier, as a non-nullString.
Parameters:
  names - a non-null array ofStrings indicating the format names.

Method Summary
abstract public  booleancanEncodeImage(ImageTypeSpecifier type)
     Returns true if the ImageWriter implementation associated with this service provider is able to encode an image with the given layout.
public  booleancanEncodeImage(RenderedImage im)
     Returns true if the ImageWriter implementation associated with this service provider is able to encode the given RenderedImage instance.
public  ImageWritercreateWriterInstance()
     Returns an instance of the ImageWriter implementation associated with this service provider.
abstract public  ImageWritercreateWriterInstance(Object extension)
     Returns an instance of the ImageWriter implementation associated with this service provider. The returned object will initially be in an initial state as if its reset method had been called.

An Object may be supplied to the plug-in at construction time.

public  String[]getImageReaderSpiNames()
     Returns an array of Strings containing all the fully qualified names of all the ImageReaderSpi classes that can understand the internal metadata representation used by the ImageWriter associated with this service provider, or null if there are no such ImageReaders specified.
public  Class[]getOutputTypes()
     Returns an array of Class objects indicating what types of objects may be used as arguments to the writer's setOutput method.
public  booleanisFormatLossless()
     Returns true if the format that this writer outputs preserves pixel data bit-accurately.
public  booleanisOwnWriter(ImageWriter writer)
     Returns true if the ImageWriter object passed in is an instance of the ImageWriter associated with this service provider.
Parameters:
  writer - an ImageWriter instance.

Field Detail
STANDARD_OUTPUT_TYPE
final public static Class[] STANDARD_OUTPUT_TYPE(Code)
A single-element array, initially containing ImageInputStream.class, to be returned from getInputTypes.



outputTypes
protected Class[] outputTypes(Code)
An array of Class objects to be returned from getOutputTypes, initially null.



readerSpiNames
protected String[] readerSpiNames(Code)
An array of strings to be returned from getImageReaderSpiNames, initially null.




Constructor Detail
ImageWriterSpi
protected ImageWriterSpi()(Code)
Constructs a blank ImageWriterSpi. It is up to the subclass to initialize instance variables and/or override method implementations in order to provide working versions of all methods.



ImageWriterSpi
public ImageWriterSpi(String vendorName, String version, String[] names, String[] suffixes, String[] MIMETypes, String writerClassName, Class[] outputTypes, String[] readerSpiNames, boolean supportsStandardStreamMetadataFormat, String nativeStreamMetadataFormatName, String nativeStreamMetadataFormatClassName, String[] extraStreamMetadataFormatNames, String[] extraStreamMetadataFormatClassNames, boolean supportsStandardImageMetadataFormat, String nativeImageMetadataFormatName, String nativeImageMetadataFormatClassName, String[] extraImageMetadataFormatNames, String[] extraImageMetadataFormatClassNames)(Code)
Constructs an ImageWriterSpi with a given set of values.
Parameters:
  vendorName - the vendor name, as a non-nullString.
Parameters:
  version - a version identifier, as a non-nullString.
Parameters:
  names - a non-null array ofStrings indicating the format names. At least oneentry must be present.
Parameters:
  suffixes - an array of Strings indicating thecommon file suffixes. If no suffixes are defined,null should be supplied. An array of length 0will be normalized to null.
Parameters:
  MIMETypes - an array of Strings indicatingthe format's MIME types. If no suffixes are defined,null should be supplied. An array of length 0will be normalized to null.
Parameters:
  writerClassName - the fully-qualified name of theassociated ImageWriterSpi class, as anon-null String.
Parameters:
  outputTypes - an array of Class objects oflength at least 1 indicating the legal output types.
Parameters:
  readerSpiNames - an array Strings of lengthat least 1 naming the classes of all associatedImageReaders, or null. An array oflength 0 is normalized to null.
Parameters:
  supportsStandardStreamMetadataFormat - aboolean that indicates whether a stream metadataobject can use trees described by the standard metadata format.
Parameters:
  nativeStreamMetadataFormatName - aString, or null, to be returned fromgetNativeStreamMetadataFormatName.
Parameters:
  nativeStreamMetadataFormatClassName - aString, or null, to be used to instantiatea metadata format object to be returned fromgetNativeStreamMetadataFormat.
Parameters:
  extraStreamMetadataFormatNames - an array ofStrings, or null, to be returned fromgetExtraStreamMetadataFormatNames. An array of length0 is normalized to null.
Parameters:
  extraStreamMetadataFormatClassNames - an array ofStrings, or null, to be used to instantiatea metadata format object to be returned fromgetStreamMetadataFormat. An array of length0 is normalized to null.
Parameters:
  supportsStandardImageMetadataFormat - aboolean that indicates whether an image metadataobject can use trees described by the standard metadata format.
Parameters:
  nativeImageMetadataFormatName - aString, or null, to be returned fromgetNativeImageMetadataFormatName.
Parameters:
  nativeImageMetadataFormatClassName - aString, or null, to be used to instantiatea metadata format object to be returned fromgetNativeImageMetadataFormat.
Parameters:
  extraImageMetadataFormatNames - an array ofStrings to be returned fromgetExtraImageMetadataFormatNames. An array of length 0is normalized to null.
Parameters:
  extraImageMetadataFormatClassNames - an array ofStrings, or null, to be used to instantiatea metadata format object to be returned fromgetImageMetadataFormat. An array of length0 is normalized to null.
exception:
  IllegalArgumentException - if vendorNameis null.
exception:
  IllegalArgumentException - if versionis null.
exception:
  IllegalArgumentException - if namesis null or has length 0.
exception:
  IllegalArgumentException - if writerClassNameis null.
exception:
  IllegalArgumentException - if outputTypesis null or has length 0.




Method Detail
canEncodeImage
abstract public boolean canEncodeImage(ImageTypeSpecifier type)(Code)
Returns true if the ImageWriter implementation associated with this service provider is able to encode an image with the given layout. The layout (i.e., the image's SampleModel and ColorModel) is described by an ImageTypeSpecifier object.

A return value of true is not an absolute guarantee of successful encoding; the encoding process may still produce errors due to factors such as I/O errors, inconsistent or malformed data structures, etc. The intent is that a reasonable inspection of the basic structure of the image be performed in order to determine if it is within the scope of the encoding format. For example, a service provider for a format that can only encode greyscale would return false if handed an RGB BufferedImage. Similarly, a service provider for a format that can encode 8-bit RGB imagery might refuse to encode an image with an associated alpha channel.

Different ImageWriters, and thus service providers, may choose to be more or less strict. For example, they might accept an image with premultiplied alpha even though it will have to be divided out of each pixel, at some loss of precision, in order to be stored.
Parameters:
  type - an ImageTypeSpecifier specifying thelayout of the image to be written. true if this writer is likely to be ableto encode images with the given layout.
exception:
  IllegalArgumentException - if typeis null.




canEncodeImage
public boolean canEncodeImage(RenderedImage im)(Code)
Returns true if the ImageWriter implementation associated with this service provider is able to encode the given RenderedImage instance. Note that this includes instances of java.awt.image.BufferedImage.

See the discussion for canEncodeImage(ImageTypeSpecifier) for information on the semantics of this method.
Parameters:
  im - an instance of RenderedImage to be encoded. true if this writer is likely to be ableto encode this image.
exception:
  IllegalArgumentException - if imis null.




createWriterInstance
public ImageWriter createWriterInstance() throws IOException(Code)
Returns an instance of the ImageWriter implementation associated with this service provider. The returned object will initially be in an initial state as if its reset method had been called.

The default implementation simply returns createWriterInstance(null). an ImageWriter instance.
exception:
  IOException - if an error occurs during loading, or initialization of the writer class, or during instantiationor initialization of the writer object.




createWriterInstance
abstract public ImageWriter createWriterInstance(Object extension) throws IOException(Code)
Returns an instance of the ImageWriter implementation associated with this service provider. The returned object will initially be in an initial state as if its reset method had been called.

An Object may be supplied to the plug-in at construction time. The nature of the object is entirely plug-in specific.

Typically, a plug-in will implement this method using code such as return new MyImageWriter(this).
Parameters:
  extension - a plug-in specific extension object, which maybe null. an ImageWriter instance.
exception:
  IOException - if the attempt to instantiatethe writer fails.
exception:
  IllegalArgumentException - if theImageWriter's constructor throws anIllegalArgumentException to indicate that theextension object is unsuitable.




getImageReaderSpiNames
public String[] getImageReaderSpiNames()(Code)
Returns an array of Strings containing all the fully qualified names of all the ImageReaderSpi classes that can understand the internal metadata representation used by the ImageWriter associated with this service provider, or null if there are no such ImageReaders specified. If a non-null value is returned, it must have non-zero length.

The first item in the array must be the name of the service provider for the "preferred" reader, as it will be used to instantiate the ImageReader returned by ImageIO.getImageReader(ImageWriter).

This mechanism may be used to obtain ImageReaders that will generated non-pixel meta-data (see IIOExtraDataInfo) in a structure understood by an ImageWriter. By reading the image and obtaining this data from one of the ImageReaders obtained with this method and passing it on to the ImageWriter, a client program can read an image, modify it in some way, and write it back out preserving all meta-data, without having to understand anything about the internal structure of the meta-data, or even about the image format. an array of Strings of length at least 1containing names of ImageReaderSpis, ornull.
See Also:   javax.imageio.ImageIO.getImageReader(ImageWriter)
See Also:   ImageReaderSpi.getImageWriterSpiNames




getOutputTypes
public Class[] getOutputTypes()(Code)
Returns an array of Class objects indicating what types of objects may be used as arguments to the writer's setOutput method.

For most writers, which only output to an ImageOutputStream, a single-element array containing ImageOutputStream.class should be returned. a non-null array ofClassobjects of length at least 1.




isFormatLossless
public boolean isFormatLossless()(Code)
Returns true if the format that this writer outputs preserves pixel data bit-accurately. The default implementation returns true. true if the format preserves full pixelaccuracy.



isOwnWriter
public boolean isOwnWriter(ImageWriter writer)(Code)
Returns true if the ImageWriter object passed in is an instance of the ImageWriter associated with this service provider.
Parameters:
  writer - an ImageWriter instance. true if writer is recognized
exception:
  IllegalArgumentException - if writer isnull.



Fields inherited from javax.imageio.spi.ImageReaderWriterSpi
protected String[] MIMETypes(Code)(Java Doc)
protected String[] extraImageMetadataFormatClassNames(Code)(Java Doc)
protected String[] extraImageMetadataFormatNames(Code)(Java Doc)
protected String[] extraStreamMetadataFormatClassNames(Code)(Java Doc)
protected String[] extraStreamMetadataFormatNames(Code)(Java Doc)
protected String[] names(Code)(Java Doc)
protected String nativeImageMetadataFormatClassName(Code)(Java Doc)
protected String nativeImageMetadataFormatName(Code)(Java Doc)
protected String nativeStreamMetadataFormatClassName(Code)(Java Doc)
protected String nativeStreamMetadataFormatName(Code)(Java Doc)
protected String pluginClassName(Code)(Java Doc)
protected String[] suffixes(Code)(Java Doc)
protected boolean supportsStandardImageMetadataFormat(Code)(Java Doc)
protected boolean supportsStandardStreamMetadataFormat(Code)(Java Doc)

Methods inherited from javax.imageio.spi.ImageReaderWriterSpi
public String[] getExtraImageMetadataFormatNames()(Code)(Java Doc)
public String[] getExtraStreamMetadataFormatNames()(Code)(Java Doc)
public String[] getFileSuffixes()(Code)(Java Doc)
public String[] getFormatNames()(Code)(Java Doc)
public IIOMetadataFormat getImageMetadataFormat(String formatName)(Code)(Java Doc)
public String[] getMIMETypes()(Code)(Java Doc)
public String getNativeImageMetadataFormatName()(Code)(Java Doc)
public String getNativeStreamMetadataFormatName()(Code)(Java Doc)
public String getPluginClassName()(Code)(Java Doc)
public IIOMetadataFormat getStreamMetadataFormat(String formatName)(Code)(Java Doc)
public boolean isStandardImageMetadataFormatSupported()(Code)(Java Doc)
public boolean isStandardStreamMetadataFormatSupported()(Code)(Java Doc)

Fields inherited from javax.imageio.spi.IIOServiceProvider
protected String vendorName(Code)(Java Doc)
protected String version(Code)(Java Doc)

Methods inherited from javax.imageio.spi.IIOServiceProvider
abstract public String getDescription(Locale locale)(Code)(Java Doc)
public String getVendorName()(Code)(Java Doc)
public String getVersion()(Code)(Java Doc)
public void onDeregistration(ServiceRegistry registry, Class category)(Code)(Java Doc)
public void onRegistration(ServiceRegistry registry, Class category)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.