Hello,

I am trying to write a sequence of Avro GenericRecords into a Java
ByteBuffer and later on deserialize them. I have tried using
FileWriter/Readers and copying the content of the underlying buffer to my
target object. The alternative is to try to split a ByteBuffer by the
serialized GenericRecords individually and use a BinaryDecoder to read each
property of a record individually.

Please see attached such an example of the former code.
The presented code fails with

org.apache.avro.AvroRuntimeException: java.io.IOException: Invalid sync!
at org.apache.avro.file.DataFileStream.hasNext(DataFileStream.java:223)
at com.feedzai.research.experiments.bookkeeper.Avro.main(Avro.java:97)
Caused by: java.io.IOException: Invalid sync!
at org.apache.avro.file.DataFileStream.nextRawBlock(DataFileStream.java:318)
at org.apache.avro.file.DataFileStream.hasNext(DataFileStream.java:212)
... 1 more

Hence my questions are:
 - Is it at all possible to serialize/deserialize lists of Avro records to
a ByteBuffer and back?
 - If so, can anyone point me in the right direction?
 - If not, can anyone point me to code examples of alternative solutions?

Thank you and have a good day.

Pedro Cardoso

Research Data Engineer

pedro.card...@feedzai.com




[image: Follow Feedzai on Facebook.] <https://www.facebook.com/Feedzai/>[image:
Follow Feedzai on Twitter!] <https://twitter.com/feedzai>[image: Connect
with Feedzai on LinkedIn!] <https://www.linkedin.com/company/feedzai/>
<https://feedzai.com/>[image: Feedzai in Forbes Fintech 50!]
<https://www.forbes.com/fintech/list/>

-- 
The content of this email is confidential and 
intended for the recipient 
specified in message only. It is strictly 
prohibited to share any part of 
this message with any third party, 
without a written consent of the 
sender. If you received this message by
 mistake, please reply to this 
message and follow with its deletion, so 
that we can ensure such a mistake 
does not occur in the future.

Reply via email to