Dev,

What you describe should work. Can you perhaps provide a simple code example to illustrate the problem you are having?

Thanks,

Doug

On 01/17/2011 04:53 AM, Devajyoti Sarkar 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

Reply via email to