javax.imageio.spi
Class ImageInputStreamSpi

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.ImageInputStreamSpi
All Implemented Interfaces:
RegisterableService sample code for javax.imageio.spi.RegisterableService definition code for javax.imageio.spi.RegisterableService

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

The service provider interface (SPI) for ImageInputStreams. 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 ImageInputStream. For example, a particular ImageInputStreamSpi might allow a generic InputStream to be used as an input source; another might take input from a URL.

By treating the creation of ImageInputStreams as a pluggable service, it becomes possible to handle future input sources without changing the API. Also, high-performance implementations of ImageInputStream (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 , ImageInputStream sample code for javax.imageio.stream.ImageInputStream definition code for javax.imageio.stream.ImageInputStream

Field Summary
protected  Class sample code for java.lang.Class definition code for java.lang.Class <?> inputClass sample code for javax.imageio.spi.ImageInputStreamSpi.inputClass definition code for javax.imageio.spi.ImageInputStreamSpi.inputClass
          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 ImageInputStreamSpi sample code for javax.imageio.spi.ImageInputStreamSpi.ImageInputStreamSpi() definition code for javax.imageio.spi.ImageInputStreamSpi.ImageInputStreamSpi() ()
          Constructs a blank ImageInputStreamSpi.
  ImageInputStreamSpi sample code for javax.imageio.spi.ImageInputStreamSpi.ImageInputStreamSpi(java.lang.String, java.lang.String, java.lang.Class) definition code for javax.imageio.spi.ImageInputStreamSpi.ImageInputStreamSpi(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 <?> inputClass)
          Constructs an ImageInputStreamSpi with a given set of values.
 
Method Summary
 boolean canUseCacheFile sample code for javax.imageio.spi.ImageInputStreamSpi.canUseCacheFile() definition code for javax.imageio.spi.ImageInputStreamSpi.canUseCacheFile() ()
          Returns true if the ImageInputStream implementation associated with this service provider can optionally make use of a cache file for improved performance and/or memory footrprint.
 ImageInputStream sample code for javax.imageio.stream.ImageInputStream definition code for javax.imageio.stream.ImageInputStream createInputStreamInstance sample code for javax.imageio.spi.ImageInputStreamSpi.createInputStreamInstance(java.lang.Object) definition code for javax.imageio.spi.ImageInputStreamSpi.createInputStreamInstance(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  input)
          Returns an instance of the ImageInputStream implementation associated with this service provider.
abstract  ImageInputStream sample code for javax.imageio.stream.ImageInputStream definition code for javax.imageio.stream.ImageInputStream createInputStreamInstance sample code for javax.imageio.spi.ImageInputStreamSpi.createInputStreamInstance(java.lang.Object, boolean, java.io.File) definition code for javax.imageio.spi.ImageInputStreamSpi.createInputStreamInstance(java.lang.Object, boolean, java.io.File) (Object sample code for java.lang.Object definition code for java.lang.Object  input, boolean useCache, File sample code for java.io.File definition code for java.io.File  cacheDir)
          Returns an instance of the ImageInputStream implementation associated with this service provider.
 Class sample code for java.lang.Class definition code for java.lang.Class <?> getInputClass sample code for javax.imageio.spi.ImageInputStreamSpi.getInputClass() definition code for javax.imageio.spi.ImageInputStreamSpi.getInputClass() ()
          Returns a Class object representing the class or interface type that must be implemented by an input source in order to be "wrapped" in an ImageInputStream via the createInputStreamInstance method.
 boolean needsCacheFile sample code for javax.imageio.spi.ImageInputStreamSpi.needsCacheFile() definition code for javax.imageio.spi.ImageInputStreamSpi.needsCacheFile() ()
          Returns true if the ImageInputStream 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

inputClass sample code for javax.imageio.spi.ImageInputStreamSpi.inputClass

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

Constructor Detail

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

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


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

public ImageInputStreamSpi(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 <?> inputClass)
Constructs an ImageInputStreamSpi with a given set of values.

Parameters:
vendorName - the vendor name.
version - a version identifier.
inputClass - a Class object indicating the legal object type for use by the createInputStreamInstance 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

getInputClass sample code for javax.imageio.spi.ImageInputStreamSpi.getInputClass() definition code for javax.imageio.spi.ImageInputStreamSpi.getInputClass()

public Class sample code for java.lang.Class definition code for java.lang.Class <?> getInputClass()
Returns a Class object representing the class or interface type that must be implemented by an input source in order to be "wrapped" in an ImageInputStream via the createInputStreamInstance method.

Typical return values might include InputStream.class or URL.class, but any class may be used.

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

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

public boolean canUseCacheFile()
Returns true if the ImageInputStream 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 useCache argument to createInputStreamInstance will be ignored.

The default implementation returns false.

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

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

public boolean needsCacheFile()
Returns true if the ImageInputStream implementation associated with this service provider requires the use of a cache File. If true, the value of the useCache argument to createInputStreamInstance will be ignored.

The default implementation returns false.

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

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

public abstract ImageInputStream sample code for javax.imageio.stream.ImageInputStream definition code for javax.imageio.stream.ImageInputStream  createInputStreamInstance(Object sample code for java.lang.Object definition code for java.lang.Object  input,
                                                           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 ImageInputStream 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:
input - an object of the class type returned by getInputClass.
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 ImageInputStream instance.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if input 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:
getInputClass() sample code for javax.imageio.spi.ImageInputStreamSpi.getInputClass() definition code for javax.imageio.spi.ImageInputStreamSpi.getInputClass() , canUseCacheFile() sample code for javax.imageio.spi.ImageInputStreamSpi.canUseCacheFile() definition code for javax.imageio.spi.ImageInputStreamSpi.canUseCacheFile() , needsCacheFile() sample code for javax.imageio.spi.ImageInputStreamSpi.needsCacheFile() definition code for javax.imageio.spi.ImageInputStreamSpi.needsCacheFile()

createInputStreamInstance sample code for javax.imageio.spi.ImageInputStreamSpi.createInputStreamInstance(java.lang.Object) definition code for javax.imageio.spi.ImageInputStreamSpi.createInputStreamInstance(java.lang.Object)

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

Parameters:
input - an object of the class type returned by getInputClass.
Returns:
an ImageInputStream instance.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if input 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:
getInputClass() sample code for javax.imageio.spi.ImageInputStreamSpi.getInputClass() definition code for javax.imageio.spi.ImageInputStreamSpi.getInputClass()