assert(offset != -1);
assert(!on);
// prepare to write
FileChannel fileChannel = persistentMap.getFileChannel();
Bufferlo chunkData = new Bufferlo();
DataOutputStream chunkDataOut = new DataOutputStream(chunkData.getOutputStream());
// write the data
chunkDataOut.writeInt(sequenceId);
chunkDataOut.writeInt(keyBytesLength);
chunkDataOut.writeInt(valueBytesLength);
chunkData.append(keyBytes);
chunkData.append(valueBytes);
chunkData.writeToChannel(fileChannel.position(offset + 16));
fileChannel.force(false);
// turn the written data on
on = true;
chunkDataOut.writeInt(1); // on == true
chunkData.writeToChannel(fileChannel.position(offset));
fileChannel.force(false);
// clean up stuff we don't need no more
keyBytes = null;
valueBytes = null;