public class AvroTestUtil
extends java.lang.Object
AvroTestUtil
class provides common utilities used for executing tests that involve
Avro.Constructor and Description |
---|
AvroTestUtil() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
createAvroFile(Schema schema,
java.util.List<GenericRecord> records)
Create Avro file for the given schema and records list.
|
static java.util.List<GenericRecord> |
readRecords(Schema schema,
byte[] contents)
Read Avro records to a list of
GenericRecord . |
public static byte[] createAvroFile(Schema schema, java.util.List<GenericRecord> records) throws java.io.IOException
schema
- Schema to use.records
- Records to write on the sink.java.io.IOException
public static java.util.List<GenericRecord> readRecords(Schema schema, byte[] contents) throws java.io.IOException
GenericRecord
.schema
- Schema to use for reading.contents
- Byte array with contents to read.java.io.IOException