FileDocCategorySizeDatePackage
SubImageInputStream.javaAPI DocJava SE 5 API1441Fri Aug 26 14:54:42 BST 2005com.sun.imageio.plugins.common

SubImageInputStream

public class SubImageInputStream extends ImageInputStreamImpl
version
0.5

Fields Summary
ImageInputStream
stream
long
startingPos
int
startingLength
int
length
Constructors Summary
public SubImageInputStream(ImageInputStream stream, int length)

        this.stream = stream;
        this.startingPos = stream.getStreamPosition();
        this.startingLength = this.length = length;
    
Methods Summary
public longlength()

        return startingLength;
    
public intread()

        if (length == 0) { // Local EOF
            return -1;
        } else {
            --length;
            return stream.read();
        }
    
public intread(byte[] b, int off, int len)

        if (length == 0) { // Local EOF
            return -1;
        }

        len = Math.min(len, length);
        int bytes = stream.read(b, off, len);
        length -= bytes;
        return bytes;
    
public voidseek(long pos)

        stream.seek(pos - startingPos);
        streamPos = pos;