FileDocCategorySizeDatePackage
CountedDataInputStream.javaAPI DocAndroid 5.1 API3697Thu Mar 12 22:22:42 GMT 2015com.android.gallery3d.exif

CountedDataInputStream

public class CountedDataInputStream extends FilterInputStream

Fields Summary
private int
mCount
private final byte[]
mByteArray
private final ByteBuffer
mByteBuffer
Constructors Summary
protected CountedDataInputStream(InputStream in)


       
        super(in);
    
Methods Summary
public java.nio.ByteOrdergetByteOrder()

        return mByteBuffer.order();
    
public intgetReadByteCount()

        return mCount;
    
public intread(byte[] b)

        int r = in.read(b);
        mCount += (r >= 0) ? r : 0;
        return r;
    
public intread(byte[] b, int off, int len)

        int r = in.read(b, off, len);
        mCount += (r >= 0) ? r : 0;
        return r;
    
public intread()

        int r = in.read();
        mCount += (r >= 0) ? 1 : 0;
        return r;
    
public intreadInt()

        readOrThrow(mByteArray, 0 , 4);
        mByteBuffer.rewind();
        return mByteBuffer.getInt();
    
public longreadLong()

        readOrThrow(mByteArray, 0 , 8);
        mByteBuffer.rewind();
        return mByteBuffer.getLong();
    
public voidreadOrThrow(byte[] b)

        readOrThrow(b, 0, b.length);
    
public voidreadOrThrow(byte[] b, int off, int len)

        int r = read(b, off, len);
        if (r != len) throw new EOFException();
    
public shortreadShort()

        readOrThrow(mByteArray, 0 ,2);
        mByteBuffer.rewind();
        return mByteBuffer.getShort();
    
public java.lang.StringreadString(int n)

        byte buf[] = new byte[n];
        readOrThrow(buf);
        return new String(buf, "UTF8");
    
public java.lang.StringreadString(int n, java.nio.charset.Charset charset)

        byte buf[] = new byte[n];
        readOrThrow(buf);
        return new String(buf, charset);
    
public longreadUnsignedInt()

        return readInt() & 0xffffffffL;
    
public intreadUnsignedShort()

        return readShort() & 0xffff;
    
public voidsetByteOrder(java.nio.ByteOrder order)

        mByteBuffer.order(order);
    
public longskip(long length)

        long skip = in.skip(length);
        mCount += skip;
        return skip;
    
public voidskipOrThrow(long length)

        if (skip(length) != length) throw new EOFException();
    
public voidskipTo(long target)

        long cur = mCount;
        long diff = target - cur;
        assert(diff >= 0);
        skipOrThrow(diff);