Hi Gareth,
Thanx you for the fast reply.
If understand you correctly we still have the problem:
Choise 1:
ByteBuffer bb = ByteBuffer.allocate(RECORD_LENGTH);
fileChannel_.read(bb);
bb.flip();
byte b = bb.get();
int flag = b & 255;
...
Choise 2:
ByteBuffer bb = ByteBuffer.allocate(1);
fileChannel_.read(bb);
bb.flip();
byte b = bb.get();
int flag = b & 255;
if (flag)== 0 then... read the rest.
In first case we have to read whole record every time (Using RAF we would not read the rest if flag ==1)
In second case we we two allocate one ByteBuffer just for flag, and one for the rest.
If these assumptions are correct, what performance ?
Regards,
Vlad