use of org.apache.avro.io.DatumReader in project trevni by cutting.
the class TestCases method fromJson.
private List<Object> fromJson(Schema schema, File file) throws Exception {
InputStream in = new FileInputStream(file);
List<Object> data = new ArrayList<Object>();
try {
DatumReader reader = new GenericDatumReader(schema);
Decoder decoder = DecoderFactory.get().jsonDecoder(schema, in);
while (true) data.add(reader.read(null, decoder));
} catch (EOFException e) {
} finally {
in.close();
}
return data;
}
Aggregations