javax.imageio.spi

Class ImageOutputStreamSpi

public abstract class ImageOutputStreamSpi extends IIOServiceProvider

An abstract superclass for service providers that create {@linkplain javax.imageio.stream.ImageOutputStream 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 {@link #createOutputStreamInstance(Object)}.
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
booleancanUseCacheFile()
Determines whether ImageOutputStreams created by this service provider benefit from using a cache file.
abstract ImageOutputStreamcreateOutputStreamInstance(Object output, boolean useCache, File cacheDir)
ImageOutputStreamcreateOutputStreamInstance(Object output)
Class<?>getOutputClass()
Determines which kind of output is produced by the streams created by {@link #createOutputStreamInstance(Object)}.
booleanneedsCacheFile()
Determines whether ImageOutputStreams created by this service provider require the use of a cache file.

Field Detail

outputClass

protected Class<?> outputClass
Indicates which kind of output is produced by the streams created by {@link #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 {@link #vendorName}, {@link #version} and {@link #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

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.

createOutputStreamInstance

public abstract ImageOutputStream createOutputStreamInstance(Object output, boolean useCache, File cacheDir)

createOutputStreamInstance

public ImageOutputStream createOutputStreamInstance(Object output)

getOutputClass

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

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.