You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Nicolas Ranc <rn...@gmail.com> on 2016/08/24 06:35:01 UTC

Decode avro binary file genericaly

Hello, i'm seeking advices on how decode (in a generic way) the data in an
avro binary file. Avro files are composed with schema and data at the end.
For exemple, if i have this avro file (attachment), i want to decode (and
put on my screen) the data, using theses functions : decodeString(),
decodeInt()... (it depend of which type is )

I tried something like :
    avro::DataFileReaderBase decode("test.bin");
    decode.init();

    std::cout<<decode.hasMore()<<std::endl; //0 = false
    while(decode.hasMore()){
       std::cout<<decode.decoder().decodeString()<<std::endl;
       std::cout<<decode.decoder().decodeDouble()<<std::endl;
    }
    decode.close();

When i do this, i always have a segmentation fault or nothing.

Thanks,
Nicolas