Provides a mapping between the Scala wrapper class S
, which should extend AvroSerializeable, and the
corresponding Java class J
, which should extend org.apache.avro.specific.SpecificRecordBase
.
Reads a serialized Avro file into the provided class.
Reads a serialized Avro file into the provided class.
val reader: AvroReader[MyAvroClass] = AvroReader[MyAvroClass] val dataRead: Seq[MyAvroClass] = reader.read("MyDataFile.avro")
Class to be deserialized
AvroSerializeable is the base trait of scala classes to be serialized or deserialized through the AvroReader and AvroWriter classes.
AvroWriter serializes a class that implements the AvroSerializeable trait and writes
to the supplied OutputStream
.
AvroWriter serializes a class that implements the AvroSerializeable trait and writes
to the supplied OutputStream
.
dataToWrite: Seq[MyOutputClass] = ... val writer = AvroWriter[MyOutputClass]("MyOutputFile.avro") writer.write(dataToWrite)
Type to be serialized
Factory for AvroWriter instances.
Provides a mapping between the Scala wrapper class
S
, which should extend AvroSerializeable, and the corresponding Java classJ
, which should extendorg.apache.avro.specific.SpecificRecordBase
. Typically an an implicit instance of this trait would be defined on the companion object of a class extending AvroSerializeable, andJ
would be a Java class produced by Avro code generation.An implicit instance with this trait will provide to Avro values that would in a Java application be provided by static members of the
SpecificRecordBase
.Scala class
Java class from Avro code generation