private void writeHeader() throws IOException {

		if (readOnly) {
			throw new IOException("File is read-only");
		}

		// Output free list
		int prev = -1;
		for (int index : freeIndexes) {
			putFreeBlock(index, prev);
			prev = index;
		}

		seekBlock(0, 0);

		// Write Header values
		raf.writeLong(MAGIC_NUMBER);
		raf.writeLong(fileId);
		raf.writeInt(HEADER_FORMAT_VERSION);
		raf.writeInt(blockSize);
		raf.writeInt(prev);

		// Write user parameter count and values
		String[] parmNames = getParameterNames();
		raf.writeInt(parmNames.length);
		int cnt = VER1_FIXED_HEADER_LENGTH;
		for (String parmName : parmNames) {
			byte[] nameBytes = parmName.getBytes(STRING_ENCODING);
			cnt += 8 + nameBytes.length;
			if (cnt > bufferSize) {
				throw new IOException("Buffer size too small");
			}
			raf.writeInt(nameBytes.length);
			raf.write(nameBytes);
			raf.writeInt(getParameter(parmName));
		}
	}
Store the user parameter and free buffer index lists and write the file header.
@throws IOException if an I/O error occurs
Ghidra/Framework/DB/src/main/java/db/buffers/LocalBufferFile.java