/** Construct for reading instances of a class. */ public SpecificDatumReader(Class<T> c) { this(new SpecificData(c.getClassLoader())); setSchema(getSpecificData().getSchema(c)); }
/** Construct for reading instances of a class. */ public SpecificDatumReader(Class<T> c) { this(SpecificData.getForClass(c)); setSchema(getSpecificData().getSchema(c)); }
public AvroStockReader() { reader = new SpecificDatumReader<Stock>(); reader.setSchema(Stock.SCHEMA$); }
/** Construct for reading instances of a class. */ public SpecificDatumReader(Class<T> c) { this(new SpecificData(c.getClassLoader())); setSchema(getSpecificData().getSchema(c)); }
/** Construct for reading instances of a class. */ public SpecificDatumReader(Class<T> c) { this(new SpecificData(c.getClassLoader())); setSchema(getSpecificData().getSchema(c)); }
/** * * Deserialize byte stream into an AvroSimpleFeature * * @param avroData serialized bytes of AvroSimpleFeature * @param avroObjectToReuse null or AvroSimpleFeature instance to be re-used. If null a new object * will be allocated. * @return instance of AvroSimpleFeature with values parsed from avroData * @throws IOException */ private static AvroSimpleFeature deserializeASF( final byte[] avroData, AvroSimpleFeature avroObjectToReuse) throws IOException { final BinaryDecoder decoder = DECODER_FACTORY.binaryDecoder(avroData, null); if (avroObjectToReuse == null) { avroObjectToReuse = new AvroSimpleFeature(); } DATUM_READER.setSchema(avroObjectToReuse.getSchema()); return DATUM_READER.read(avroObjectToReuse, decoder); } }