avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: Setting bytes in Java
Date Mon, 17 Jan 2011 18:45:55 GMT
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

Mime
View raw message