public class ImageInputStreamAdapter extends ImageInputStreamImpl implements AccessibleStream<InputStream>
ImageInputStream
that gets its input from
a regular InputStream
. No buffering is performed in this
adapter hence it is suitable whenever the underlying is is able to perform
marking itself, like it happens for a BufferedInputStream
.
In general, it is preferable to use a FileCacheImageInputStream
or MemoryCacheImageInputStream
when reading from a regular
InputStream
, but this class can help with improving
perfomances in some cases.
bitOffset, byteOrder, flushedPos, streamPos
Constructor and Description |
---|
ImageInputStreamAdapter(InputStream stream)
Constructs a n
ImageInputStreamAdapter that will read from
a given InputStream . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this
ImageInputStreamAdapter . |
Class<InputStream> |
getBinding()
Retrieve the class for the target object.
|
static ImageInputStream |
getStream(InputStream stream) |
InputStream |
getTarget()
Retrieves the target object on which we work.
|
boolean |
isCached()
Returns
true since this ImageInputStream
does not cache data in order to allow seeking backwards but it relies on
the underlying InputStream . |
boolean |
isCachedFile()
Returns
false since this ImageInputStream
does not maintain a eraf cache. |
boolean |
isCachedMemory()
Returns
false since this ImageInputStream
does not maintain a main memory cache. |
void |
mark() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
checkClosed, finalize, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, length, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, seek, setBitOffset, setByteOrder, skipBytes, skipBytes
public ImageInputStreamAdapter(InputStream stream)
ImageInputStreamAdapter
that will read from
a given InputStream
.is
- an InputStream
to read from.IllegalArgumentException
- if is
is null
.public int read() throws IOException
read
in interface ImageInputStream
read
in class ImageInputStreamImpl
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in interface ImageInputStream
read
in class ImageInputStreamImpl
IOException
public boolean isCached()
true
since this ImageInputStream
does not cache data in order to allow seeking backwards but it relies on
the underlying InputStream
.isCached
in interface ImageInputStream
isCached
in class ImageInputStreamImpl
true
.isCachedMemory()
,
isCachedFile()
public boolean isCachedFile()
false
since this ImageInputStream
does not maintain a eraf cache.isCachedFile
in interface ImageInputStream
isCachedFile
in class ImageInputStreamImpl
false
.isCached()
,
isCachedMemory()
public boolean isCachedMemory()
false
since this ImageInputStream
does not maintain a main memory cache.isCachedMemory
in interface ImageInputStream
isCachedMemory
in class ImageInputStreamImpl
true
.isCached()
,
isCachedFile()
public void close() throws IOException
ImageInputStreamAdapter
. The source
InputStream
is not closed.close
in interface Closeable
close
in interface AutoCloseable
close
in interface ImageInputStream
close
in class ImageInputStreamImpl
IOException
public void mark()
mark
in interface ImageInputStream
mark
in class ImageInputStreamImpl
public void reset() throws IOException
reset
in interface ImageInputStream
reset
in class ImageInputStreamImpl
IOException
public static final ImageInputStream getStream(InputStream stream)
public InputStream getTarget()
AccessibleStream
getTarget
in interface AccessibleStream<InputStream>
public Class<InputStream> getBinding()
AccessibleStream
getBinding
in interface AccessibleStream<InputStream>
Copyright © 2006–2016 GeoSolutions. All rights reserved.