it.geosolutions.imageio.stream.input.spi
Class FileImageInputStreamExtImplSpi
Object
IIOServiceProvider
ImageInputStreamSpi
FileImageInputStreamExtImplSpi
- All Implemented Interfaces:
- RegisterableService
public class FileImageInputStreamExtImplSpi
- extends ImageInputStreamSpi
Implementation of an ImageInputStreamSpi
for instantiating an
ImageInputStream
capable of connecting to a File
by means of
an EnhancedRandomAccessFile
which gives buffering capabilities.
It is worth to point out that ImageIO
already provide the
FileChannelImageInputStream
in order to efficiently access images
with buffering. despite to this I have ran into many problems with
FileChannel
s especially on Windows machines, hence I came up with
this ImageInputStream
subclass and this ImageInputStreamSpi
which gives similar performances for most uses but far less problems.
- Author:
- Daniele Romagnoli, GeoSolutions, Simone Giannecchini, GeoSolutions
- See Also:
ImageInputStream
,
ImageInputStreamSpi
,
ImageIO.createImageInputStream(Object)
Method Summary |
ImageInputStream |
createInputStreamInstance(Object input,
boolean useCache,
File cacheDir)
Returns an instance of the ImageInputStream implementation associated
with this service provider. |
String |
getDescription(Locale locale)
|
void |
onRegistration(ServiceRegistry registry,
Class<?> category)
Upon registration, this method ensures that this SPI is listed at the top
of the ImageInputStreamSpi items, so that it will be invoked before the
default FileImageInputStreamSpi |
Methods inherited from class ImageInputStreamSpi |
canUseCacheFile, createInputStreamInstance, getInputClass, needsCacheFile |
Methods inherited from class IIOServiceProvider |
getVendorName, getVersion, onDeregistration |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileImageInputStreamExtImplSpi
public FileImageInputStreamExtImplSpi()
- 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.
getDescription
public String getDescription(Locale locale)
- Specified by:
getDescription
in class IIOServiceProvider
- See Also:
IIOServiceProvider.getDescription(Locale).
onRegistration
public void onRegistration(ServiceRegistry registry,
Class<?> category)
- Upon registration, this method ensures that this SPI is listed at the top
of the ImageInputStreamSpi items, so that it will be invoked before the
default FileImageInputStreamSpi
- Specified by:
onRegistration
in interface RegisterableService
- Overrides:
onRegistration
in class IIOServiceProvider
- Parameters:
registry
- ServiceRegistry where this object has been registered.category
- a Class object indicating the registry category under which
this object has been registered.
createInputStreamInstance
public ImageInputStream createInputStreamInstance(Object input,
boolean useCache,
File cacheDir)
- Returns an instance of the ImageInputStream implementation associated
with this service provider.
- Specified by:
createInputStreamInstance
in class ImageInputStreamSpi
- Parameters:
input
- an object of the class type returned by getInputClass.useCache
- a boolean indicating whether a cache eraf should be used, in
cases where it is optional.cacheDir
- a File indicating where the cache eraf should be created, or
null to use the system directory.
- Returns:
- an ImageInputStream instance.
- Throws:
IllegalArgumentException
- if input is not an instance of the correct class or is null.
Copyright © 2006-2010 GeoSolutions. All Rights Reserved.