@Override
	public synchronized long write(long offset, byte[] buf, long curSize) {
		long newSize = offset + buf.length;
		if (newSize > Integer.MAX_VALUE || newSize < 0) {
			throw new EmuIOException("File size cannot exceed " + Integer.MAX_VALUE + " bytes");
		}
		if (newSize > content.length) {
			byte[] grown = new byte[content.length * 2];
			System.arraycopy(content, 0, grown, 0, (int) curSize);
			content = grown;
		}
		System.arraycopy(buf, 0, content, (int) offset, buf.length);
		return buf.length;
	}
A concrete in-memory bytes store for simulated file contents

<p>
Note that currently, the total contents cannot exceed a Java array, so the file must remain less
than 2GB in size.
Ghidra/Features/SystemEmulation/src/main/java/ghidra/pcode/emu/sys/BytesEmuFileContents.java