@Override public void readExternal(ObjectInput in) throws IOException { new SpecificDatumReader(getSchema()) .read(this, SpecificData.getDecoder(in)); }
@Override public void writeExternal(ObjectOutput out) throws IOException { new SpecificDatumWriter(getSchema()) .write(this, SpecificData.getEncoder(out)); }
/** * Creates a SpecificRecordBuilderBase by copying an existing record instance. * @param other the record instance to copy. */ protected SpecificRecordBuilderBase(T other) { super(other.getSchema(), SpecificData.getForSchema(other.getSchema())); } }
@SuppressWarnings("OptionalUsedAsFieldOrParameterType") private static <T> AvroFactory<T> fromSpecific(Class<T> type, ClassLoader cl, Optional<Schema> previousSchema) { SpecificData specificData = new SpecificData(cl); Schema newSchema = specificData.getSchema(type); return new AvroFactory<>( specificData, newSchema, new SpecificDatumReader<>(previousSchema.orElse(newSchema), newSchema, specificData), new SpecificDatumWriter<>(newSchema, specificData) ); }
/** * Instantiates a new Avro byte array converter based on class. * * @param typeParameterClass the type parameter class */ public AvroByteArrayConverter(Class<T> typeParameterClass) { super(); avroReader = new SpecificDatumReader<T>(typeParameterClass); avroWriter = new SpecificDatumWriter<T>(typeParameterClass); }
@SuppressWarnings("all") @org.apache.avro.specific.AvroGenerated public interface EmployeeAvro { public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"EmployeeAvro\",\"namespace\":\"org.apache.hadoop.hive.hbase.avro\",\"types\":[{\"type\":\"enum\",\"name\":\"Gender\",\"symbols\":[\"MALE\",\"FEMALE\"]},{\"type\":\"record\",\"name\":\"HomePhone\",\"fields\":[{\"name\":\"areaCode\",\"type\":\"long\"},{\"name\":\"number\",\"type\":\"long\"}]},{\"type\":\"record\",\"name\":\"OfficePhone\",\"fields\":[{\"name\":\"areaCode\",\"type\":\"long\"},{\"name\":\"number\",\"type\":\"long\"}]},{\"type\":\"record\",\"name\":\"Address\",\"fields\":[{\"name\":\"address1\",\"type\":\"string\"},{\"name\":\"address2\",\"type\":\"string\"},{\"name\":\"city\",\"type\":\"string\"},{\"name\":\"zipcode\",\"type\":\"long\"},{\"name\":\"county\",\"type\":[\"HomePhone\",\"OfficePhone\",\"string\",\"null\"]},{\"name\":\"aliases\",\"type\":[{\"type\":\"array\",\"items\":\"string\"},\"null\"]},{\"name\":\"metadata\",\"type\":[\"null\",{\"type\":\"map\",\"values\":\"string\"}]}]},{\"type\":\"record\",\"name\":\"ContactInfo\",\"fields\":[{\"name\":\"address\",\"type\":[{\"type\":\"array\",\"items\":\"Address\"},\"null\"]},{\"name\":\"homePhone\",\"type\":\"HomePhone\"},{\"name\":\"officePhone\",\"type\":\"OfficePhone\"}]},{\"type\":\"record\",\"name\":\"Employee\",\"fields\":[{\"name\":\"employeeName\",\"type\":\"string\"},{\"name\":\"employeeID\",\"type\":\"long\"},{\"name\":\"age\",\"type\":\"long\"},{\"name\":\"gender\",\"type\":\"Gender\"},{\"name\":\"contactInfo\",\"type\":\"ContactInfo\"}]}],\"messages\":{}}"); @SuppressWarnings("all") public interface Callback extends EmployeeAvro { public static final org.apache.avro.Protocol PROTOCOL = org.apache.hadoop.hive.hbase.avro.EmployeeAvro.PROTOCOL; } }
@Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { READER$.read(this, SpecificData.getDecoder(in)); }
@Override public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException { WRITER$.write(this, SpecificData.getEncoder(out)); }
/** Construct for reading instances of a class. */ public SpecificDatumReader(Class<T> c) { this(SpecificData.getForClass(c)); setSchema(getSpecificData().getSchema(c)); }
@Override public void readExternal(ObjectInput in) throws IOException { new SpecificDatumReader(getSchema()) .read(this, SpecificData.getDecoder(in)); } }
@Override public void writeExternal(ObjectOutput out) throws IOException { new SpecificDatumWriter(getSchema()) .write(this, SpecificData.getEncoder(out)); }
/** * Instantiates a new Avro json converter based on class. * * @param schema the schema * @param typeParameterClass the type parameter class */ public AvroJsonConverter(Schema schema, Class<T> typeParameterClass) { super(); this.schema = schema; avroReader = new SpecificDatumReader<T>(typeParameterClass); avroWriter = new SpecificDatumWriter<T>(typeParameterClass); }
@Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in)); }
@Override public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException { WRITER$.write(this, SpecificData.getEncoder(out)); }
@Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { READER$.read(this, SpecificData.getDecoder(in)); }
@Override public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException { WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out)); }
@Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in)); }
@Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { READER$.read(this, SpecificData.getDecoder(in)); }
@Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { READER$.read(this, SpecificData.getDecoder(in)); }
@Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { READER$.read(this, SpecificData.getDecoder(in)); }