Package com.twelvemonkeys.imageio.stream
Class SubImageInputStream
- java.lang.Object
-
- javax.imageio.stream.ImageInputStreamImpl
-
- com.twelvemonkeys.imageio.stream.SubImageInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.DataInput
,java.lang.AutoCloseable
,javax.imageio.stream.ImageInputStream
public final class SubImageInputStream extends javax.imageio.stream.ImageInputStreamImpl
A wrapper forImageInputStream
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$
- Author:
- Harald Kuhr, last modified by $Author: haraldk$
-
-
Constructor Summary
Constructors Constructor Description SubImageInputStream(javax.imageio.stream.ImageInputStream pStream, long pLength)
Creates aImageInputStream
, reading up to a maximum number of bytes from the underlying stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finalize()
long
length()
int
read()
int
read(byte[] pBytes, int pOffset, int pLength)
void
seek(long pPosition)
-
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
-
-
-
-
Constructor Detail
-
SubImageInputStream
public SubImageInputStream(javax.imageio.stream.ImageInputStream pStream, long pLength) throws java.io.IOException
Creates aImageInputStream
, reading up to a maximum number of bytes from the underlying stream.- Parameters:
pStream
- the underlying streampLength
- the maximum length to read from the stream. Note thatpStream
may contain less than this maximum number of bytes.- Throws:
java.io.IOException
- ifpStream
's position can't be determined.java.lang.IllegalArgumentException
- ifpStream == null
orpLength < 0
-
-
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[] pBytes, int pOffset, int pLength) throws java.io.IOException
- Specified by:
read
in interfacejavax.imageio.stream.ImageInputStream
- Specified by:
read
in classjavax.imageio.stream.ImageInputStreamImpl
- Throws:
java.io.IOException
-
length
public long length()
- Specified by:
length
in interfacejavax.imageio.stream.ImageInputStream
- Overrides:
length
in classjavax.imageio.stream.ImageInputStreamImpl
-
seek
public void seek(long pPosition) throws java.io.IOException
- Specified by:
seek
in interfacejavax.imageio.stream.ImageInputStream
- Overrides:
seek
in classjavax.imageio.stream.ImageInputStreamImpl
- Throws:
java.io.IOException
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjavax.imageio.stream.ImageInputStreamImpl
- Throws:
java.lang.Throwable
-
-