private static <T> T genericRecordFromBytes(byte[] bytes, Schema schema) throws IOException {
    BinaryDecoder binDecoder = DecoderFactory.defaultFactory().createBinaryDecoder(bytes, null);
    GenericDatumReader<T> reader = new GenericDatumReader<>(schema);
    return reader.read(null, binDecoder);
  }
Avro SerDe that can be used to serialize or deserialize the avro {@link GenericRecord}.
samza-tools/src/main/java/org/apache/samza/tools/avro/AvroSerDeFactory.java