Avro format read with java library apache.avro
-
Import ‘org.apache.avro:avro:1.9.0’ (choose proper version)
-
follow like this
String path = getClass().getResource(path).getPath();
File file = New File(path);
DatumReader<GenericRecord> datumReader = new GenericDatumReader<>();
DataFileReader<GenericRecord> dataFileReader = new DataFileReader<>(file, datumReader);
record = dataFileReader.next(record);
record.get(key).toString();