Hi,

> -----Ursprüngliche Nachricht-----
> Von: Rendy Bambang Junior [mailto:rendy.b.jun...@gmail.com]
> Gesendet: Mittwoch, 25. März 2015 10:08
> An: user@avro.apache.org
> Betreff: Deserialize Avro Object Without Schema
> 
> It should be possible right? Since the schema itself is embedded in the data.
> 
yes and it is working for me. Altough I'm reading data from a file, and I 
create a 
DataFileReader from the GenericDatumReader which then reads the deserialized 
data.
On a quick look, I didn't find a FileReader for streams.
Here is my example:

   DatumReader<GenericRecord> datumReader = new 
GenericDatumReader<GenericRecord>();
    DataFileReader<GenericRecord> dataFileReader = null;
    try {
      dataFileReader = new DataFileReader(DATA_FILE, datumReader);
    } catch (IOException exp) {
      System.out.println("Could not read file " + DATA_FILE.getName());
      System.exit(1);
    }

    GenericRecord person = null;
    try {
      person = dataFileReader.next(person);
    } catch (IOException exp) {
      System.out.println("Could not read user from file " + 
DATA_FILE.getName());
      System.exit(1);
    }

    System.out.println("Id:    " + person.get("id"));
    System.out.println("Name:  " + person.get("name"));
    System.out.println("Email: " + person.get("email"));

--
Regards
Alexander Zenger


Reply via email to