Beispiel #1
0
        /// <summary>
        /// This reads a single serialized datum from a file (not an Avro file container
        /// complete with schema, but the datum only).
        /// </summary>
        private static TransferRequest DeserializeSingleDatumFrom(string file)
        {
            var result = new TransferRequest();

            using (var stream = new FileStream(file, FileMode.Open))
            {
                var decoder = new Avro.IO.BinaryDecoder(stream);
                var reader  = new Avro.Specific.SpecificDefaultReader(result.Schema, result.Schema);
                reader.Read(result, decoder);
            }

            return(result);
        }
Beispiel #2
0
 public SpecificReader(SpecificDefaultReader reader)
 {
     this.reader = reader;
 }
Beispiel #3
0
 /// <summary>
 /// Constructs a generic reader for the given schemas using the DefaultReader. If the
 /// reader's and writer's schemas are different this class performs the resolution.
 /// </summary>
 /// <param name="writerSchema">The schema used while generating the data</param>
 /// <param name="readerSchema">The schema desired by the reader</param>
 public SpecificReader(Schema writerSchema, Schema readerSchema)
 {
     reader = new SpecificDefaultReader(writerSchema, readerSchema);
 }