FileDocCategorySizeDatePackage
PositionedInputStream.javaAPI DocAndroid 1.5 API2392Wed May 06 22:41:04 BST 2009org.apache.harmony.luni.util

PositionedInputStream

public class PositionedInputStream extends FilterInputStream
This class implements a Stream whose position can be queried for.

Fields Summary
private int
currentPosition
Constructors Summary
public PositionedInputStream(InputStream in)
Constructs a new instance of the receiver.

param
in The actual input stream where to read the bytes from.

        super(in);
    
Methods Summary
public intcurrentPosition()
Return the current position in the receiver

return
int The current position in the receiver

        return currentPosition;
    
public intread()

        int read = in.read();
        if (read >= 0) {
            currentPosition++;
        }
        return read;

    
public intread(byte[] b, int off, int len)

        int read = in.read(b, off, len);
        if (read >= 0) {
            currentPosition += read;
        }
        return read;
    
public voidresetCurrentPosition()
Makes the current position on the underlying stream be assigned relative position zero.

        currentPosition = 0;
    
public longskip(long n)

        long skip = in.skip(n);
        currentPosition += skip; // Maybe currentPosition should be long ?
        return skip;