I am reading a file using RandomFileAccess, FileChannel and ByteBuffer as follows:
RandomAccessFile myFile = new RandomAccessFile("/Users/****/Documents/a.txt", "rw");
FileChannel myInChannel = myFile.getChannel();
ByteBuffer bb = ByteBuffer.allocate(48);
int bytesRead = myInChannel.read(bb);
while (bytesRead != -1) {
// do something
}
myFile.close();
All this code is working fine. But i am wondering is there any way i can read the data using Future?