/** * Reads records of the given type from an Avro file (or multiple Avro files matching a pattern). * * <p>The schema must be specified using one of the {@code withSchema} functions. */ public static <T> Read<T> read(Class<T> recordClass) { return new AutoValue_AvroIO_Read.Builder<T>() .setMatchConfiguration(MatchConfiguration.create(EmptyMatchTreatment.DISALLOW)) .setRecordClass(recordClass) .setSchema(ReflectData.get().getSchema(recordClass)) .setHintMatchesManyFiles(false) .build(); }
/** Reads Avro file(s) containing records of the specified schema. */ public static Read<GenericRecord> readGenericRecords(Schema schema) { return new AutoValue_AvroIO_Read.Builder<GenericRecord>() .setMatchConfiguration(MatchConfiguration.create(EmptyMatchTreatment.DISALLOW)) .setRecordClass(GenericRecord.class) .setSchema(schema) .setHintMatchesManyFiles(false) .build(); }