Code example for ByteBuffer

Methods: position, remaining

0
        return read(b, 0, b.length);
    } 
 
    @Override 
    public long skip(long n) throws IOException {
        long newPos = bb.position() + n;
        if (newPos > bb.remaining()) {
            n = bb.remaining();
        } 
        bb.position(bb.position() + (int) n);
        return n;
    } 
 
}