Code example for ByteBuffer

Methods: get, remaining

0
        return bb.remaining();
    } 
 
    @Override 
    public int read(byte[] b, int off, int len) throws IOException {
        if (bb.remaining() == 0) {
            return -1; 
        } 
        if (len > bb.remaining()) {
            len = bb.remaining();
        } 
        bb.get(b, off, len);
        return len;
    } 
 
    @Override 
    public int read(byte[] b) throws IOException {
        return read(b, 0, b.length);
    } 
 
    @Override