Package com.twelvemonkeys.imageio.stream
Class DirectImageInputStream
- java.lang.Object
-
- javax.imageio.stream.ImageInputStreamImpl
-
- com.twelvemonkeys.imageio.stream.DirectImageInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.DataInput
,java.lang.AutoCloseable
,javax.imageio.stream.ImageInputStream
public final class DirectImageInputStream extends javax.imageio.stream.ImageInputStreamImpl
AnImageInputStream
that adapts anInputSteam
, by reading directly from the stream without and form of caching or buffering.Note: This is not a general-purpose
ImageInputStream
, and is designed for reading large chunks, typically of pixel data, from anInputStream
. It does not support backwards seeking, or reading bits.
-
-
Constructor Summary
Constructors Constructor Description DirectImageInputStream(java.io.InputStream stream)
DirectImageInputStream(java.io.InputStream stream, long length)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
long
getFlushedPosition()
long
length()
int
read()
int
read(byte[] bytes, int off, int len)
int
readBit()
long
readBits(int numBits)
void
seek(long pos)
-
Methods inherited from class javax.imageio.stream.ImageInputStreamImpl
checkClosed, finalize, flush, flushBefore, getBitOffset, getByteOrder, getStreamPosition, isCached, isCachedFile, isCachedMemory, mark, read, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, setBitOffset, setByteOrder, skipBytes, skipBytes
-
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException
- Specified by:
read
in interfacejavax.imageio.stream.ImageInputStream
- Specified by:
read
in classjavax.imageio.stream.ImageInputStreamImpl
- Throws:
java.io.IOException
-
read
public int read(byte[] bytes, int off, int len) throws java.io.IOException
- Specified by:
read
in interfacejavax.imageio.stream.ImageInputStream
- Specified by:
read
in classjavax.imageio.stream.ImageInputStreamImpl
- Throws:
java.io.IOException
-
seek
public void seek(long pos) throws java.io.IOException
- Specified by:
seek
in interfacejavax.imageio.stream.ImageInputStream
- Overrides:
seek
in classjavax.imageio.stream.ImageInputStreamImpl
- Throws:
java.io.IOException
-
getFlushedPosition
public long getFlushedPosition()
- Specified by:
getFlushedPosition
in interfacejavax.imageio.stream.ImageInputStream
- Overrides:
getFlushedPosition
in classjavax.imageio.stream.ImageInputStreamImpl
-
length
public long length()
- Specified by:
length
in interfacejavax.imageio.stream.ImageInputStream
- Overrides:
length
in classjavax.imageio.stream.ImageInputStreamImpl
-
readBit
public int readBit() throws java.io.IOException
- Specified by:
readBit
in interfacejavax.imageio.stream.ImageInputStream
- Overrides:
readBit
in classjavax.imageio.stream.ImageInputStreamImpl
- Throws:
java.io.IOException
-
readBits
public long readBits(int numBits) throws java.io.IOException
- Specified by:
readBits
in interfacejavax.imageio.stream.ImageInputStream
- Overrides:
readBits
in classjavax.imageio.stream.ImageInputStreamImpl
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacejavax.imageio.stream.ImageInputStream
- Overrides:
close
in classjavax.imageio.stream.ImageInputStreamImpl
- Throws:
java.io.IOException
-
-