Package org.monte.media.io
Class ImageInputStreamImpl2
- java.lang.Object
-
- javax.imageio.stream.ImageInputStreamImpl
-
- org.monte.media.io.ImageInputStreamImpl2
-
- All Implemented Interfaces:
Closeable
,DataInput
,AutoCloseable
,ImageInputStream
- Direct Known Subclasses:
ByteArrayImageInputStream
public abstract class ImageInputStreamImpl2 extends ImageInputStreamImpl
ImageInputStreamImpl2
fixes bugs in ImageInputStreamImpl.ImageInputStreamImpl uses read(byte[]) instead of readFully(byte[]) inside of readShort. This results in corrupt data input if the underlying stream can not fulfill the read operation in a single step.
- Version:
- $Id: ImageInputStreamImpl2.java 348 2015-09-23 17:46:43Z werner $
- Author:
- Werner Randelshofer
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
byteBuf
Byte buffer used for readFully(type[], int, int).-
Fields inherited from class javax.imageio.stream.ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos
-
-
Constructor Summary
Constructors Constructor Description ImageInputStreamImpl2()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
readInt()
short
readShort()
-
Methods inherited from class javax.imageio.stream.ImageInputStreamImpl
checkClosed, close, finalize, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, length, mark, read, read, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readLine, readLong, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, seek, setBitOffset, setByteOrder, skipBytes, skipBytes
-
-
-
-
Field Detail
-
byteBuf
protected byte[] byteBuf
Byte buffer used for readFully(type[], int, int). Note that this array is also used for bulk reads in readShort(), readInt(), etc, so it should be large enough to hold a primitive value (i.e. >= 8 bytes). Also note that this array is package protected, so that it can be used by ImageOutputStreamImpl in a similar manner.
-
-
Method Detail
-
readShort
public short readShort() throws IOException
- Specified by:
readShort
in interfaceDataInput
- Specified by:
readShort
in interfaceImageInputStream
- Overrides:
readShort
in classImageInputStreamImpl
- Throws:
IOException
-
readInt
public int readInt() throws IOException
- Specified by:
readInt
in interfaceDataInput
- Specified by:
readInt
in interfaceImageInputStream
- Overrides:
readInt
in classImageInputStreamImpl
- Throws:
IOException
-
-