Class SubImageInputStream
java.lang.Object
javax.imageio.stream.ImageInputStreamImpl
com.twelvemonkeys.imageio.stream.SubImageInputStream
- All Implemented Interfaces:
Closeable, DataInput, AutoCloseable, ImageInputStream
A wrapper for
ImageInputStream to limit the number of bytes that can be read.- Version:
- $Id: SubImageInputStream.java,v 1.0 Nov 8, 2009 2:50:58 PM haraldk Exp$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longprivate final longprivate final ImageInputStreamFields inherited from class ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos -
Constructor Summary
ConstructorsConstructorDescriptionSubImageInputStream(ImageInputStream stream, long length) Creates aImageInputStream, reading up to a maximum number of bytes from the underlying stream. -
Method Summary
Methods inherited from class ImageInputStreamImpl
checkClosed, close, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, mark, 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, reset, setBitOffset, setByteOrder, skipBytes, skipBytes
-
Field Details
-
stream
-
startPos
private final long startPos -
length
private final long length
-
-
Constructor Details
-
SubImageInputStream
Creates aImageInputStream, reading up to a maximum number of bytes from the underlying stream.- Parameters:
stream- the underlying streamlength- the maximum length to read from the stream. Note thatstreammay contain less than this maximum number of bytes.- Throws:
IOException- ifstream's position can't be determined.IllegalArgumentException- ifstream == nullorlength < 0
-
-
Method Details
-
read
- Specified by:
readin interfaceImageInputStream- Specified by:
readin classImageInputStreamImpl- Throws:
IOException
-
read
- Specified by:
readin interfaceImageInputStream- Specified by:
readin classImageInputStreamImpl- Throws:
IOException
-
length
public long length()- Specified by:
lengthin interfaceImageInputStream- Overrides:
lengthin classImageInputStreamImpl
-
seek
- Specified by:
seekin interfaceImageInputStream- Overrides:
seekin classImageInputStreamImpl- Throws:
IOException
-
finalize
protected void finalize()- Overrides:
finalizein classImageInputStreamImpl
-