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

        readFully((ReadableByteChannel) file, buffer);
    }
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