javax.imageio.spi
Class ImageOutputStreamSpi

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.imageio.spi.IIOServiceProvider sample code for javax.imageio.spi.IIOServiceProvider definition code for javax.imageio.spi.IIOServiceProvider 
      extended by javax.imageio.spi.ImageOutputStreamSpi
All Implemented Interfaces:
RegisterableService sample code for javax.imageio.spi.RegisterableService definition code for javax.imageio.spi.RegisterableService

public abstract class ImageOutputStreamSpi
extends IIOServiceProvider sample code for javax.imageio.spi.IIOServiceProvider definition code for javax.imageio.spi.IIOServiceProvider

The service provider interface (SPI) for ImageOutputStreams. For more information on service provider interfaces, see the class comment for the IIORegistry class.

This interface allows arbitrary objects to be "wrapped" by instances of ImageOutputStream. For example, a particular ImageOutputStreamSpi might allow a generic OutputStream to be used as a destination; another might output to a File or to a device such as a serial port.

By treating the creation of ImageOutputStreams as a pluggable service, it becomes possible to handle future output destinations without changing the API. Also, high-performance implementations of ImageOutputStream (for example, native implementations for a particular platform) can be installed and used transparently by applications.

See Also:
IIORegistry sample code for javax.imageio.spi.IIORegistry definition code for javax.imageio.spi.IIORegistry , ImageOutputStream sample code for javax.imageio.stream.ImageOutputStream definition code for javax.imageio.stream.ImageOutputStream

Field Summary
protected  Class sample code for java.lang.Class definition code for java.lang.Class <?> outputClass sample code for javax.imageio.spi.ImageOutputStreamSpi.outputClass definition code for javax.imageio.spi.ImageOutputStreamSpi.outputClass
          A Class object indicating the legal object type for use by the createInputStreamInstance method.
 
Fields inherited from class javax.imageio.spi.IIOServiceProvider sample code for javax.imageio.spi.IIOServiceProvider definition code for javax.imageio.spi.IIOServiceProvider
vendorName sample code for javax.imageio.spi.IIOServiceProvider.vendorName definition code for javax.imageio.spi.IIOServiceProvider.vendorName , version sample code for javax.imageio.spi.IIOServiceProvider.version definition code for javax.imageio.spi.IIOServiceProvider.version
 
Constructor Summary
protected ImageOutputStreamSpi sample code for javax.imageio.spi.ImageOutputStreamSpi.ImageOutputStreamSpi() definition code for javax.imageio.spi.ImageOutputStreamSpi.ImageOutputStreamSpi() ()
          Constructs a blank ImageOutputStreamSpi.
  ImageOutputStreamSpi sample code for javax.imageio.spi.ImageOutputStreamSpi.ImageOutputStreamSpi(java.lang.String, java.lang.String, java.lang.Class) definition code for javax.imageio.spi.ImageOutputStreamSpi.ImageOutputStreamSpi(java.lang.String, java.lang.String, java.lang.Class) (String sample code for java.lang.String definition code for java.lang.String  vendorName, String sample code for java.lang.String definition code for java.lang.String  version, Class sample code for java.lang.Class definition code for java.lang.Class <?> outputClass)
          Constructs an ImageOutputStreamSpi with a given set of values.
 
Method Summary
 boolean canUseCacheFile sample code for javax.imageio.spi.ImageOutputStreamSpi.canUseCacheFile() definition code for javax.imageio.spi.ImageOutputStreamSpi.canUseCacheFile() ()
          Returns true if the ImageOutputStream implementation associated with this service provider can optionally make use of a cache File for improved performance and/or memory footrprint.
 ImageOutputStream sample code for javax.imageio.stream.ImageOutputStream definition code for javax.imageio.stream.ImageOutputStream createOutputStreamInstance sample code for javax.imageio.spi.ImageOutputStreamSpi.createOutputStreamInstance(java.lang.Object) definition code for javax.imageio.spi.ImageOutputStreamSpi.createOutputStreamInstance(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  output)
          Returns an instance of the ImageOutputStream implementation associated with this service provider.
abstract  ImageOutputStream sample code for javax.imageio.stream.ImageOutputStream definition code for javax.imageio.stream.ImageOutputStream createOutputStreamInstance sample code for javax.imageio.spi.ImageOutputStreamSpi.createOutputStreamInstance(java.lang.Object, boolean, java.io.File) definition code for javax.imageio.spi.ImageOutputStreamSpi.createOutputStreamInstance(java.lang.Object, boolean, java.io.File) (Object sample code for java.lang.Object definition code for java.lang.Object  output, boolean useCache, File sample code for java.io.File definition code for java.io.File  cacheDir)
          Returns an instance of the ImageOutputStream implementation associated with this service provider.
 Class sample code for java.lang.Class definition code for java.lang.Class <?> getOutputClass sample code for javax.imageio.spi.ImageOutputStreamSpi.getOutputClass() definition code for javax.imageio.spi.ImageOutputStreamSpi.getOutputClass() ()
          Returns a Class object representing the class or interface type that must be implemented by an output destination in order to be "wrapped" in an ImageOutputStream via the createOutputStreamInstance method.
 boolean needsCacheFile sample code for javax.imageio.spi.ImageOutputStreamSpi.needsCacheFile() definition code for javax.imageio.spi.ImageOutputStreamSpi.needsCacheFile() ()
          Returns true if the ImageOutputStream implementation associated with this service provider requires the use of a cache File.
 
Methods inherited from class javax.imageio.spi.IIOServiceProvider sample code for javax.imageio.spi.IIOServiceProvider definition code for javax.imageio.spi.IIOServiceProvider
getDescription sample code for javax.imageio.spi.IIOServiceProvider.getDescription(java.util.Locale) definition code for javax.imageio.spi.IIOServiceProvider.getDescription(java.util.Locale) , getVendorName sample code for javax.imageio.spi.IIOServiceProvider.getVendorName() definition code for javax.imageio.spi.IIOServiceProvider.getVendorName() , getVersion sample code for javax.imageio.spi.IIOServiceProvider.getVersion() definition code for javax.imageio.spi.IIOServiceProvider.getVersion() , onDeregistration sample code for javax.imageio.spi.IIOServiceProvider.onDeregistration(javax.imageio.spi.ServiceRegistry, java.lang.Class) definition code for javax.imageio.spi.IIOServiceProvider.onDeregistration(javax.imageio.spi.ServiceRegistry, java.lang.Class) , onRegistration sample code for javax.imageio.spi.IIOServiceProvider.onRegistration(javax.imageio.spi.ServiceRegistry, java.lang.Class) definition code for javax.imageio.spi.IIOServiceProvider.onRegistration(javax.imageio.spi.ServiceRegistry, java.lang.Class)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

outputClass sample code for javax.imageio.spi.ImageOutputStreamSpi.outputClass

protected Class sample code for java.lang.Class definition code for java.lang.Class <?> outputClass
A Class object indicating the legal object type for use by the createInputStreamInstance method.

Constructor Detail

ImageOutputStreamSpi sample code for javax.imageio.spi.ImageOutputStreamSpi() definition code for javax.imageio.spi.ImageOutputStreamSpi()

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


ImageOutputStreamSpi sample code for javax.imageio.spi.ImageOutputStreamSpi(java.lang.String, java.lang.String, java.lang.Class<?>) definition code for javax.imageio.spi.ImageOutputStreamSpi(java.lang.String, java.lang.String, java.lang.Class<?>)

public ImageOutputStreamSpi(String sample code for java.lang.String definition code for java.lang.String  vendorName,
                            String sample code for java.lang.String definition code for java.lang.String  version,
                            Class sample code for java.lang.Class definition code for java.lang.Class <?> outputClass)
Constructs an ImageOutputStreamSpi with a given set of values.

Parameters:
vendorName - the vendor name.
version - a version identifier.
outputClass - a Class object indicating the legal object type for use by the createOutputStreamInstance method.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if vendorName is null.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if version is null.
Method Detail

getOutputClass sample code for javax.imageio.spi.ImageOutputStreamSpi.getOutputClass() definition code for javax.imageio.spi.ImageOutputStreamSpi.getOutputClass()

public Class sample code for java.lang.Class definition code for java.lang.Class <?> getOutputClass()
Returns a Class object representing the class or interface type that must be implemented by an output destination in order to be "wrapped" in an ImageOutputStream via the createOutputStreamInstance method.

Typical return values might include OutputStream.class or File.class, but any class may be used.

Returns:
a Class variable.
See Also:
createOutputStreamInstance(Object, boolean, File) sample code for javax.imageio.spi.ImageOutputStreamSpi.createOutputStreamInstance(java.lang.Object, boolean, java.io.File) definition code for javax.imageio.spi.ImageOutputStreamSpi.createOutputStreamInstance(java.lang.Object, boolean, java.io.File)

canUseCacheFile sample code for javax.imageio.spi.ImageOutputStreamSpi.canUseCacheFile() definition code for javax.imageio.spi.ImageOutputStreamSpi.canUseCacheFile()

public boolean canUseCacheFile()
Returns true if the ImageOutputStream implementation associated with this service provider can optionally make use of a cache File for improved performance and/or memory footrprint. If false, the value of the cacheFile argument to createOutputStreamInstance will be ignored.

The default implementation returns false.

Returns:
true if a cache file can be used by the output streams created by this service provider.

needsCacheFile sample code for javax.imageio.spi.ImageOutputStreamSpi.needsCacheFile() definition code for javax.imageio.spi.ImageOutputStreamSpi.needsCacheFile()

public boolean needsCacheFile()
Returns true if the ImageOutputStream implementation associated with this service provider requires the use of a cache File.

The default implementation returns false.

Returns:
true if a cache file is needed by the output streams created by this service provider.

createOutputStreamInstance sample code for javax.imageio.spi.ImageOutputStreamSpi.createOutputStreamInstance(java.lang.Object, boolean, java.io.File) definition code for javax.imageio.spi.ImageOutputStreamSpi.createOutputStreamInstance(java.lang.Object, boolean, java.io.File)

public abstract ImageOutputStream sample code for javax.imageio.stream.ImageOutputStream definition code for javax.imageio.stream.ImageOutputStream  createOutputStreamInstance(Object sample code for java.lang.Object definition code for java.lang.Object  output,
                                                             boolean useCache,
                                                             File sample code for java.io.File definition code for java.io.File  cacheDir)
                                                      throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Returns an instance of the ImageOutputStream implementation associated with this service provider. If the use of a cache file is optional, the useCache parameter will be consulted. Where a cache is required, or not applicable, the value of useCache will be ignored.

Parameters:
output - an object of the class type returned by getOutputClass.
useCache - a boolean indicating whether a cache file should be used, in cases where it is optional.
cacheDir - a File indicating where the cache file should be created, or null to use the system directory.
Returns:
an ImageOutputStream instance.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if output is not an instance of the correct class or is null.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if a cache file is needed, but cacheDir is non-null and is not a directory.
IOException sample code for java.io.IOException definition code for java.io.IOException - if a cache file is needed but cannot be created.
See Also:
getOutputClass() sample code for javax.imageio.spi.ImageOutputStreamSpi.getOutputClass() definition code for javax.imageio.spi.ImageOutputStreamSpi.getOutputClass()

createOutputStreamInstance sample code for javax.imageio.spi.ImageOutputStreamSpi.createOutputStreamInstance(java.lang.Object) definition code for javax.imageio.spi.ImageOutputStreamSpi.createOutputStreamInstance(java.lang.Object)

public ImageOutputStream sample code for javax.imageio.stream.ImageOutputStream definition code for javax.imageio.stream.ImageOutputStream  createOutputStreamInstance(Object sample code for java.lang.Object definition code for java.lang.Object  output)
                                             throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Returns an instance of the ImageOutputStream implementation associated with this service provider. A cache file will be created in the system-dependent default temporary-file directory, if needed.

Parameters:
output - an object of the class type returned by getOutputClass.
Returns:
an ImageOutputStream instance.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if output is not an instance of the correct class or is null.
IOException sample code for java.io.IOException definition code for java.io.IOException - if a cache file is needed but cannot be created.
See Also:
getOutputClass() sample code for javax.imageio.spi.ImageOutputStreamSpi.getOutputClass() definition code for javax.imageio.spi.ImageOutputStreamSpi.getOutputClass()