I had found the answer.

ByteBuffer received on server also contain some additional data. The real
data is  only between position and limit.

Here is my code:
byte[] bytes = ArrayUtils.subarray(data.array, data.position(),
data.limit())
in that, data is ByteBuffer.

Thanks.

On Mon, May 23, 2011 at 3:32 PM, Kevin Clark <[email protected]> wrote:

> What version of the compiler are you running?
>
> On Mon, May 23, 2011 at 12:26 AM, JKnight JKnight <[email protected]>
> wrote:
> > Dear all,
> >
> > My service use binary data type.
> >
> > Here is my Thrift script. My Server use THaHsServer.
> > service SimpleService{
> >    oneway void putData(1:binary data),
> > }
> >
> > I use Java client. Ex,
> > client.putData(ByteBuffer.wrap(bytes));
> >
> > I check the data received by Server. I found that data length of byte
> array
> > in client and server is different.
> >
> > So when I deserialize data from ByteBuffer, the error occur.
> >
> > Could you help me?
> >
> > Thank a lot for support.
> >
> > --
> > Best regards,
> > JKnight
> >
>
>
>
> --
> Kevin Clark
> http://glu.ttono.us
>



-- 
Best regards,
JKnight

Reply via email to