private static final SpecificDatumReader reader =
new SpecificDatumReader();
@SuppressWarnings({ "unchecked", "deprecation" })
public static Object fromBytes(Schema schema, byte[] val) throws IOException {
Type type = schema.getType();
switch (type) {
case ENUM: return AvroUtils.getEnumValue(schema, val[0]);
case STRING: return new Utf8(Bytes.toString(val));
case BYTES: return ByteBuffer.wrap(val);
case INT: return Bytes.toInt(val);