Code example for MappedByteBuffer

Methods: get

0
     * @see java.io.RandomAccessFile#read() 
     * @return int next integer or -1 on EOF 
     */ 
    public int read() { 
        try { 
            byte b = mappedByteBuffer.get();
            int n = b & 0xff;
             
            return n;
        } catch (BufferUnderflowException e) {
            return -1; // EOF 
        } 
    } 
     
    /** 
     * @see java.io.RandomAccessFile#read(byte[], int, int) 
     * @param bytes byte[] 
     * @param off int offset 
     * @param len int length 
     * @return int bytes read or -1 on EOF 
     */