Package com.twelvemonkeys.imageio.stream
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 long
private final long
private final ImageInputStream
Fields inherited from class javax.imageio.stream.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 javax.imageio.stream.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 thatstream
may contain less than this maximum number of bytes.- Throws:
IOException
- ifstream
's position can't be determined.IllegalArgumentException
- ifstream == null
orlength < 0
-
-
Method Details
-
read
- Specified by:
read
in interfaceImageInputStream
- Specified by:
read
in classImageInputStreamImpl
- Throws:
IOException
-
read
- Specified by:
read
in interfaceImageInputStream
- Specified by:
read
in classImageInputStreamImpl
- Throws:
IOException
-
length
public long length()- Specified by:
length
in interfaceImageInputStream
- Overrides:
length
in classImageInputStreamImpl
-
seek
- Specified by:
seek
in interfaceImageInputStream
- Overrides:
seek
in classImageInputStreamImpl
- Throws:
IOException
-
finalize
protected void finalize()- Overrides:
finalize
in classImageInputStreamImpl
-