private void encodeCharTypeRef(Encoder encoder, int size) throws IOException {
		if (size == dataOrganization.getCharSize()) {
			encoder.openElement(ELEM_TYPEREF);
			encoder.writeString(ATTRIB_NAME, charMap.name);	// could have size 1 or 2
			encoder.writeUnsignedInteger(ATTRIB_ID, charMap.id);
			encoder.closeElement(ELEM_TYPEREF);
			return;
		}
		if (size == dataOrganization.getWideCharSize()) {
			encoder.openElement(ELEM_TYPEREF);
			encoder.writeString(ATTRIB_NAME, wCharMap.name);
			encoder.writeUnsignedInteger(ATTRIB_ID, wCharMap.id);
			encoder.closeElement(ELEM_TYPEREF);
			return;
		}
		if (size == 2) {
			encoder.openElement(ELEM_TYPEREF);
			encoder.writeString(ATTRIB_NAME, wChar16Map.name);
			encoder.writeUnsignedInteger(ATTRIB_ID, wChar16Map.id);
			encoder.closeElement(ELEM_TYPEREF);
			return;
		}
		if (size == 4) {
			encoder.openElement(ELEM_TYPEREF);
			encoder.writeString(ATTRIB_NAME, wChar32Map.name);
			encoder.writeUnsignedInteger(ATTRIB_ID, wChar32Map.id);
			encoder.closeElement(ELEM_TYPEREF);
			return;
		}
		if (size == 1) {
			encoder.openElement(ELEM_TYPEREF);
			encoder.writeString(ATTRIB_NAME, byteMap.name);
			encoder.writeUnsignedInteger(ATTRIB_ID, byteMap.id);
			encoder.closeElement(ELEM_TYPEREF);
			return;
		}
		throw new IllegalArgumentException("Unsupported character size");
	}
Encode a reference element for a character data-type, based on the size in bytes to a stream.
@param encoder is the stream encoder
@param size is the requested size of the character data-type
@throws IOException for errors in the underlying stream
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/PcodeDataTypeManager.java