Code example for EOFException

0
        mCount += skip;
        return skip;
    } 
 
    public void skipOrThrow(long length) throws IOException {
        if (skip(length) != length) throw new EOFException();
    } 
 
    public void skipTo(long target) throws IOException {
        long cur = mCount;
        long diff = target - cur;
        assert(diff >= 0);
        skipOrThrow(diff);
    } 
 
    public void readOrThrow(byte[] b, int off, int len) throws IOException {
        int r = read(b, off, len);
        if (r != len) throw new EOFException();
    } 
 
    public void readOrThrow(byte[] b) throws IOException {