public static void readFully(FileChannel file, long posistion, ByteBuffer buffer) throws IOException {
        Preconditions.checkState(file.size() - posistion >= buffer.remaining());

        int read = 0;
        while (buffer.hasRemaining()) {
            int rt = file.read(buffer, posistion + read);
            if (rt < 0) {
                throw new IOException("End of file");
            }
            read += rt;
        }
    }
Slow function, should only used in test. Unless, you choose to optimize it.
This function will not move the position of <i>from</i>.
indexr-common/src/main/java/io/indexr/util/IOUtil.java