int count = 1;
while (excerpt.index(index + 1) && count++ < MAX_MESSAGE) {
if (excerpt.remaining() + 4 >= bb.capacity() - bb.position())
break;
// if there is free space, copy another one.
int size2 = excerpt.capacity();
// System.out.println("W+ "+size);
bb.limit(bb.position() + size2 + 4);
bb.putInt(size2);
excerpt.read(bb);