Here you can find the source of getByteBuffer(String filePath, int start, long size)
public static ByteBuffer getByteBuffer(String filePath, int start, long size) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class Main { public static ByteBuffer getByteBuffer(String filePath, int start, long size) throws IOException { File binaryFile = new File(filePath); FileChannel binaryFileChannel = new RandomAccessFile(binaryFile, "r").getChannel(); return binaryFileChannel.map(FileChannel.MapMode.READ_ONLY, start, size); }/*w w w.j a v a 2 s .com*/ }