javax.imageio.spi
Class ImageOutputStreamSpi

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

public abstract class ImageOutputStreamSpi
extends IIOServiceProvider

An abstract superclass for service providers that create image output streams for a file, URL, byte array or any other target.

Since:
1.4

Field Summary
protected  Class<?> outputClass
          Indicates which kind of output is produced by the streams created by createOutputStreamInstance(Object).
 
Fields inherited from class javax.imageio.spi.IIOServiceProvider
vendorName, version
 
Constructor Summary
protected ImageOutputStreamSpi()
          Constructs a service provider for image output streams, given no parameters.
  ImageOutputStreamSpi(String vendorName, String version, Class<?> outputClass)
          Constructs a service provider for image output streams, given the vendor name, a version string and the kind of producable output.
 
Method Summary
 boolean canUseCacheFile()
          Determines whether ImageOutputStreams created by this service provider benefit from using a cache file.
 ImageOutputStream createOutputStreamInstance(Object output)
           
abstract  ImageOutputStream createOutputStreamInstance(Object output, boolean useCache, File cacheDir)
           
 Class<?> getOutputClass()
          Determines which kind of output is produced by the streams created by createOutputStreamInstance(Object).
 boolean needsCacheFile()
          Determines whether ImageOutputStreams created by this service provider require the use of a cache file.
 
Methods inherited from class javax.imageio.spi.IIOServiceProvider
getDescription, getVendorName, getVersion, onDeregistration, onRegistration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputClass

protected Class<?> outputClass
Indicates which kind of output is produced by the streams created by createOutputStreamInstance(Object).

Constructor Detail

ImageOutputStreamSpi

protected ImageOutputStreamSpi()
Constructs a service provider for image output streams, given no parameters. It is up to the sub-class to set IIOServiceProvider.vendorName, IIOServiceProvider.version and outputClass to non-null values.


ImageOutputStreamSpi

public ImageOutputStreamSpi(String vendorName,
                            String version,
                            Class<?> outputClass)
Constructs a service provider for image output streams, given the vendor name, a version string and the kind of producable output.

Throws:
IllegalArgumentException - if vendorName or version is null.
Method Detail

getOutputClass

public Class<?> getOutputClass()
Determines which kind of output is produced by the streams created by createOutputStreamInstance(Object).


canUseCacheFile

public boolean canUseCacheFile()
Determines whether ImageOutputStreams created by this service provider benefit from using a cache file.

The default behavior is to return false.

Returns:
true if the created streams are faster or need less memory when a cache file is being used; false if no positive effect results from the cache file.

needsCacheFile

public boolean needsCacheFile()
Determines whether ImageOutputStreams created by this service provider require the use of a cache file.

The default behavior is to return false.

Returns:
true if the created streams can only work when a cache file is being used; false if no cache file is needed.

createOutputStreamInstance

public abstract ImageOutputStream createOutputStreamInstance(Object output,
                                                             boolean useCache,
                                                             File cacheDir)
                                                      throws IOException
Throws:
IOException

createOutputStreamInstance

public ImageOutputStream createOutputStreamInstance(Object output)
                                             throws IOException
Throws:
IOException