BinaryEncoder buffers data, you may have to call flush() to see it in the output stream.
On 1/17/11 4:53 AM, "Devajyoti Sarkar" <[email protected]<mailto:[email protected]>> wrote: Hi, I am just beginning to use Avro, so I apologize if this is a silly question. I would like to set a field of type "bytes" in Java. I am assuming that all I need to do is wrap a byte[] in a ByteBuffer to set the value. Unfortunately that does not seem to work. I am using a BinaryEncoder and looking at its output, it has not written any the bytes that were in the array. The first four values of the array are 0, -128, -128, -128. Is it because Java uses 8-bit signed bytes while the Avro spec calls for 8-bit unsigned bytes in a field of type "bytes"? If so, how does one convert Java bytes to the kind accepted by Avro? Thanks in advance. Dev
