best practice for processing large binary file

Andrew M andrew at oc384.net
Mon Sep 26 14:51:15 PDT 2011


> For JDK7 I don't know if there's a better / new way but I would
> use MappedByteBuffer for such cases:
> http://download.oracle.com/javase/7/docs/api/java/nio/MappedByteBuffer.html

Should I still have a thread reading the file's records into a queue 
while another consumer thread consumes the byte arrays from the queue? 
Or is it now just as good for me to have just a single thread calling 
myMappedByteBuffer.getFloat or getInt, etc since the myMappedByteBuffer 
is reading the file in another thread?

What if the file being read is larger than available heap?

Thanks!
Andrew


More information about the nio-discuss mailing list