public class FileImageInputStreamExtImplSpi extends ImageInputStreamSpi
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.
ImageInputStream
,
ImageInputStreamSpi
,
ImageIO.createImageInputStream(Object)
Constructor and Description |
---|
FileImageInputStreamExtImplSpi()
Constructs a blank
ImageInputStreamSpi . |
Modifier and Type | Method and Description |
---|---|
ImageInputStream |
createInputStreamInstance(Object input,
boolean useCache,
File cacheDir)
Returns an instance of the ImageInputStream implementation associated
with this service provider.
|
String |
getDescription(Locale locale) |
static boolean |
isUseFileChannel() |
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
|
static void |
setUseFileChannel(boolean useFileChannel) |
canUseCacheFile, createInputStreamInstance, getInputClass, needsCacheFile
getVendorName, getVersion, onDeregistration
public FileImageInputStreamExtImplSpi()
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.public String getDescription(Locale locale)
getDescription
in class IIOServiceProvider
IIOServiceProvider.getDescription(Locale).
public void onRegistration(ServiceRegistry registry, Class<?> category)
onRegistration
in interface RegisterableService
onRegistration
in class IIOServiceProvider
registry
- ServiceRegistry where this object has been registered.category
- a Class object indicating the registry category under which
this object has been registered.public ImageInputStream createInputStreamInstance(Object input, boolean useCache, File cacheDir)
createInputStreamInstance
in class ImageInputStreamSpi
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.IllegalArgumentException
- if input is not an instance of the correct class or is null.public static boolean isUseFileChannel()
public static void setUseFileChannel(boolean useFileChannel)
Copyright © 2006–2019 GeoSolutions. All rights reserved.