Code example for MappedByteBuffer

Methods: get

0
		byteBuffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
		offset = 0;
	} 
	 
    protected int readByte() throws IOException { 
    	return byteBuffer.get() & 0xFF; 
    } 
     
    public String readString() throws IOException {
        final int l = readInt();
        byte[] b = new byte[l];
        //byteBuffer.position(offset); 
        byteBuffer.get(b);
        offset += l;
        return new String(b);
    } 
}