mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From netsql <cekven...@gmail.com>
Subject Re: ByteBuffer.order(ByteOrder.LITTLE_ENDIAN); //bug?
Date Thu, 15 Jun 2006 19:35:08 GMT
getUnsignedInt(); gets some random #.

61 05 00 00
needs to be 561 in 4 bytes.

So... I should write my own methods to read it a byte at a time and flip?

.V


Niklas Therning wrote:
>>
>> But when the stream has:
>> 61 05 00 00 and I get as byte[4]
>> I get 6105 and should get 561.
> 
> No, you should get {61,05, 00, 00}. :) get(byte[] dst) will get byte by
> byte thus the current byte order doesn't apply at all. In fact MINA just
> calls java.nio.ByteBuffer.get(byte[] dst, int offset, int length). From
> Sun's docs for that method:

> 
> I think you need to call getInt() for the byte order to be used.
> 


Mime
View raw message