public void encodeType(Encoder encoder, DataType type, int size) throws IOException {
		if (type != null && type.getDataTypeManager() != progDataTypes) {
			type = type.clone(progDataTypes);
		}
		if ((type instanceof VoidDataType) || (type == null)) {
			encodeVoid(encoder);
		}
		else if (type instanceof TypeDef) {
			encodeTypeDef(encoder, (TypeDef) type, size);
		}
		else if (type instanceof Pointer) {
			encodePointer(encoder, (Pointer) type, null, null, size);
		}
		else if (type instanceof Array) {
			encodeArray(encoder, (Array) type, size);
		}
		else if (type instanceof Structure) {
			encodeStructure(encoder, (Structure) type, size);
		}
		else if (type instanceof Union) {
			encodeUnion(encoder, (Union) type);
		}
		else if (type instanceof Enum) {
			encodeEnum(encoder, (Enum) type, size);
		}
		else if (type instanceof CharDataType) {
			encodeCharDataType(encoder, (CharDataType) type, size);
		}
		else if (type instanceof WideCharDataType || type instanceof WideChar16DataType ||
			type instanceof WideChar32DataType) {
			encodeWideCharDataType(encoder, type);
		}
		else if (type instanceof AbstractStringDataType) {
			if ((type instanceof StringDataType) || (type instanceof TerminatedStringDataType)) {
				encodeStringDataType(encoder, size);
			}
			else if (type instanceof StringUTF8DataType) {
				encodeStringUTF8DataType(encoder, size);
			}
			else if ((type instanceof UnicodeDataType) ||
				(type instanceof TerminatedUnicodeDataType)) {
				encodeUnicodeDataType(encoder, size);
			}
			else if ((type instanceof Unicode32DataType) ||
				(type instanceof TerminatedUnicode32DataType)) {
				encodeUnicode32DataType(encoder, size);
			}
			else {
				encodeOpaqueString(encoder, type, size);
			}
		}
		else if (type instanceof FunctionDefinition) {
			encodeFunctionDefinition(encoder, (FunctionDefinition) type);
		}
		else if (type instanceof BooleanDataType) {
			encodeBooleanDataType(encoder, type);
		}
		else if (type instanceof AbstractIntegerDataType) { // must handle char and bool above
			encodeAbstractIntegerDataType(encoder, (AbstractIntegerDataType) type, size);
		}
		else if (type instanceof AbstractFloatDataType) {
			encodeAbstractFloatDataType(encoder, type);
		}
		else {
			encodeOpaqueDataType(encoder, type, size);
		}
	}
Encode information for a data-type to the stream

@param encoder is the stream encoder
@param type is the data-type to encode
@param size is the size of the data-type
@throws IOException for errors in the underlying stream
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/PcodeDataTypeManager.java