public boolean updateBlob(CliBlob updatedBlob, Address addr, Program program) {

		// Get and validate the containing structure at the given address
		Data containingData = program.getListing().getDefinedDataContaining(addr);
		if (containingData == null || !containingData.isStructure()) {
			Msg.error(this, "Containing data of " + updatedBlob.getName() + " at address " + addr +
				" is not a structure.");
			return false;
		}
		Structure containingStructure = (Structure) containingData.getDataType();

		// Make sure there is an old blob at the given address
		int structureOffset = (int) addr.subtract(containingData.getAddress());
		DataTypeComponent oldBlobDataComponent =
			containingStructure.getComponentAt(structureOffset);
		if (oldBlobDataComponent == null) {
			Msg.error(this, "Existing blob at address " + addr + " was not found.");
			return false;
		}

		// Make sure the old blob has the same size as the new blob
		DataType oldBlobDataType = oldBlobDataComponent.getDataType();
		DataType newBlobDataType = updatedBlob.toDataType(program.getDataTypeManager());
		if (oldBlobDataType.getLength() != newBlobDataType.getLength()) {
			Msg.error(this,
				"Cannot replace existing blob at address " + addr + " with " +
					updatedBlob.getName() + " because they have different sizes (Old: " +
					oldBlobDataType.getLength() + ", New: " + newBlobDataType.getLength() + ").");
			return false;
		}

		// Update the blob
		containingStructure.replaceAtOffset(structureOffset, newBlobDataType, updatedBlob.getSize(),
			updatedBlob.getName(), updatedBlob.getContentsComment());

		return true;
	}
Updates the blob at the given address with the new blob.

@param updatedBlob The updated blob.
@param addr The address of the blob to update.
@param program The program that will get the update.
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/streams/CliStreamBlob.java