Created
October 27, 2017 16:33
-
-
Save tom-code/1582c1294e54b060da1b20fbcb52045e to your computer and use it in GitHub Desktop.
decode avro data (java/generic)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//avro-tools.jar needed | |
Schema schema = new Schema.Parser().parse(new File("/data/work/avro/message.avro")); | |
DatumReader<GenericRecord> dr = new GenericDatumReader<GenericRecord>(schema); | |
InputStream in = new FileInputStream(new File("/data/work/avro/record_pack/record_1_202571858.bin")); | |
BinaryDecoder decoder= DecoderFactory.get().binaryDecoder(in, null); | |
GenericRecord out = dr.read(null, decoder); | |
System.out.println(out); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment