com.twelvemonkeys.imageio.stream
Class SubImageInputStream

java.lang.Object
  extended by javax.imageio.stream.ImageInputStreamImpl
      extended by com.twelvemonkeys.imageio.stream.SubImageInputStream
All Implemented Interfaces:
DataInput, ImageInputStream

public final class SubImageInputStream
extends ImageInputStreamImpl

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$
Author:
Harald Kuhr, last modified by $Author: haraldk$

Field Summary
 
Fields inherited from class javax.imageio.stream.ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos
 
Constructor Summary
SubImageInputStream(ImageInputStream pStream, long pLength)
          Creates a ImageInputStream, reading up to a maximum number of bytes from the underlying stream.
 
Method Summary
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
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubImageInputStream

public SubImageInputStream(ImageInputStream pStream,
                           long pLength)
                    throws IOException
Creates a ImageInputStream, reading up to a maximum number of bytes from the underlying stream.

Parameters:
pStream - the underlying stream
pLength - the maximum length to read from the stream. Note that pStream may contain less than this maximum number of bytes.
Throws:
IOException - if pStream's position can't be determined.
IllegalArgumentException - if pStream == null or pLength < 0
Method Detail

read

public int read()
         throws IOException
Specified by:
read in interface ImageInputStream
Specified by:
read in class ImageInputStreamImpl
Throws:
IOException

read

public int read(byte[] pBytes,
                int pOffset,
                int pLength)
         throws IOException
Specified by:
read in interface ImageInputStream
Specified by:
read in class ImageInputStreamImpl
Throws:
IOException

length

public long length()
Specified by:
length in interface ImageInputStream
Overrides:
length in class ImageInputStreamImpl

seek

public void seek(long pPosition)
          throws IOException
Specified by:
seek in interface ImageInputStream
Overrides:
seek in class ImageInputStreamImpl
Throws:
IOException

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class ImageInputStreamImpl
Throws:
Throwable


Copyright © 2015. All Rights Reserved.