I am holding byte blocks (of, e.g., 16 bytes) in a large byte
array (of n·16 bytes) sorted with respect to those blocks.
I also have another unsorted byte array of »recent additions«.
It is anticipated that often it has to be determined whether a
certain block is contained in any of those two arrays.
I.e., both blocks together implement a »set of byte blocks«.
Eventually, the recent additions will be sorted and then both
arrays will be written out to a file. The file is to contain
the byte blocks of both arrays in a sorted order, so the next
byte block written is chosen from both arrays to be the
smallest left.
I assume that I could implement the file access via either
java.io or java.nio. So, what should I choose?
In the web I read, that »NIO will be particularly relevant for
developers of high-performance applications such as database
engines«. My pair of arrays might be considered to be a kind
of »database engine«. But still I do not know whether
java.nio will have any benefits in my case.
Roedy Green - 01 Sep 2007 13:29 GMT
>But still I do not know whether
> java.nio will have any benefits in my case.
With NIO you plop your data directly in to the buffer. From there it
goes straight to disk, (or at least your can arrange that). With
ordinary i/o, data gets passed from level to level, usually in tiny
chunks. You can't very well help but come out faster with NIO.
However NIO is not as intuitive as ordinary i/o and is even uglier, so
you likely would not want to bother unless there were a pressing need
for the speed.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com