protected void encode(DataSchema schema, boolean originallyInlined) throws IOException { TypeRepresentation representation = selectTypeRepresentation(schema, originallyInlined); markEncountered(schema); if (schema.isPrimitive()) { _builder.writeString(schema.getUnionMemberKey()); } else if (schema instanceof NamedDataSchema) { encodeNamed((NamedDataSchema) schema, representation); } else { encodeUnnamed(schema); } }