use of org.apache.flink.formats.avro.utils.MutableByteArrayInputStream in project flink by apache.
the class AvroDeserializationSchema method checkAvroInitialized.
void checkAvroInitialized() {
if (datumReader != null) {
return;
}
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (SpecificRecord.class.isAssignableFrom(recordClazz)) {
@SuppressWarnings("unchecked") SpecificData specificData = AvroFactory.getSpecificDataForClass((Class<? extends SpecificData>) recordClazz, cl);
this.datumReader = new SpecificDatumReader<>(specificData);
this.reader = AvroFactory.extractAvroSpecificSchema(recordClazz, specificData);
} else {
this.reader = new Schema.Parser().parse(schemaString);
GenericData genericData = new GenericData(cl);
this.datumReader = new GenericDatumReader<>(null, this.reader, genericData);
}
this.inputStream = new MutableByteArrayInputStream();
this.decoder = DecoderFactory.get().binaryDecoder(inputStream, null);
}
Aggregations