public static void encode(Encoder encoder, Varnode[] varnodes, long logicalsize)
			throws IOException {
		if (varnodes == null) {
			encoder.openElement(ELEM_ADDR);
			encoder.closeElement(ELEM_ADDR);
			return;
		}
		if ((varnodes.length == 1) && (logicalsize == 0)) {
			AddressXML.encode(encoder, varnodes[0].getAddress(), varnodes[0].getSize());
			return;
		}
		if (varnodes.length > MAX_PIECES) {
			throw new IOException("Exceeded maximum pieces in one join address");
		}
		encoder.openElement(ELEM_ADDR);
		encoder.writeSpace(ATTRIB_SPACE, AddressSpace.VARIABLE_SPACE);
		for (int i = 0; i < varnodes.length; ++i) {
			encoder.writeStringIndexed(ATTRIB_PIECE, i, varnodes[i].encodePiece());
		}
		if (logicalsize != 0) {
			encoder.writeUnsignedInteger(ATTRIB_LOGICALSIZE, logicalsize);
		}
		encoder.closeElement(ELEM_ADDR);
	}
Encode a sequence of Varnodes as a single {@code <addr>} element to the stream.
If there is more than one Varnode, or if the logical size is non-zero,
the {@code <addr>} element will specify the address space as "join" and will have
additional "piece" attributes.

@param encoder is the stream encoder
@param varnodes is the sequence of storage varnodes
@param logicalsize is the logical size value of the varnode
@throws IOException for errors in the underlying stream
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/AddressXML.java