docs: private void writeHeader(long fileLength, int elementCount, long firstPosition, long lastPosition)
        throws IOException {
      raf.seek(0);
  
      if (versioned) {
        writeInt(buffer, 0, VERSIONED_HEADER);
        writeLong(buffer, 4, fileLength);
        writeInt(buffer, 12, elementCount);
        writeLong(buffer, 16, firstPosition);
        writeLong(buffer, 24, lastPosition);
        raf.write(buffer, 0, 32);
        return;
      }
  
      // Legacy queue header.
      writeInt(buffer, 0, (int) fileLength); // Signed, so leading bit is always 0 aka legacy.
      writeInt(buffer, 4, elementCount);
      writeInt(buffer, 8, (int) firstPosition);
      writeInt(buffer, 12, (int) lastPosition);
      raf.write(buffer, 0, 16);
    }