private void writeHeader(int fileLength, int elementCount, int firstPosition, int lastPosition)
      throws IOException {
    writeInt(buffer, 0, fileLength);
    writeInt(buffer, 4, elementCount);
    writeInt(buffer, 8, firstPosition);
    writeInt(buffer, 12, lastPosition);
    raf.seek(0);
    raf.write(buffer);
  }
private void writeHeader ( int fileLength , int elementCount , int firstPosition , int lastPosition ) throws IOException { writeInt ( buffer , 0 , fileLength ) ; writeInt ( buffer , 4 , elementCount ) ; writeInt ( buffer , 8 , firstPosition ) ; writeInt ( buffer , 12 , lastPosition ) ; raf . seek ( 0 ) ; raf . write ( buffer ) ; }
Writes header atomically. The arguments contain the updated values. The class member fields
should not have changed yet. This only updates the state in the file. It's up to the caller to
update the class member variables *after* this call succeeds. Assumes segment writes are atomic
in the underlying file system.