Code example for ByteBuffer

Methods: get, remaining

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