BufferedByteWriter buffer = new BufferedByteWriter();
buffer.put(magicNumber);
buffer.putInt(version);
// Reserve space for the master index pointer and byte count.
// The actual values will be written at the end
indexPositionPosition = buffer.bytesWritten();
buffer.putLong(0l); // File position for start of index
buffer.putInt(0); // Size in bytes of index
final byte[] bytes = buffer.getBytes();
write(bytes);