[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Writing Little Endian Binary Data (Was: Long in the...)
Just as an observation, I have been doing something similar - only
using the ByteBuffer classes in NIO and just changing the byteorder to
whatever order I needed the data in. Seemed to be easier and worked
cleanly with the Channel API in 1.4+.
On Thursday, April 10, 2003, at 08:24 AM, Scott P. Smith wrote:
> Rob,
>
> Someone mentioned the Apache POI project earlier. The
> org.apache.poi.util
> package in that project has what you need, I think. That project has
> do to
> all the kind of stuff you are doing, so the code is there somewhere.
> Look at
> the org.apache.poi.util.LittleEndian class. It reads (and writes)
> different
> primitive data types from (to) a byte array. Of course, you would use
> this
> class in combination with a java.io.BufferedInputStream and/or a
> java.io.BufferedOutputStream.
>
> Scott Smith
>
> ----- Original Message -----
> From: "Rob Rutherford" <rrutherford@dglenn.com>
> To: "Atlanta Java Users Group" <ajug-members@ajug.org>
> Sent: Wednesday, April 09, 2003 10:47 PM
> Subject: Re: Looking for Long Tooth...
>
>
>>
>> Hello all,
>>
>> I'm new to AJUG, and fairly new to the Atlanta area, (actually
>> Columbus), and I've been lurking on the list for the past couple of
>> months. This topic strikes me as highly relavant to what I'm doing
>> right now.
>>
>> I have a binary formatted file consisting of unsigned binary data
>> types,
>> (bytes through longs) with mixed big endian and little endian fields.
>> Does anybody have any suggestions for handeling such a beast?
>>
>>
>> Thanks
>> Rob Rutherford
>>
>>
>>
>> On Wed, 2003-04-09 at 09:31, Scott P. Smith wrote:
>>
>>> * Non-Java Binary File I/O - When working with binary files that were
>>> created in C, C++, etc. you will see a lot of use of things like
> unsigned
>>> 16, and 32 bit values. Since Java doesn't support these, you have to
>>> use
>>> bitwise operators to put the uint16 into a Java int32. And vise
>>> versa.
>>>
>>
>>
>>
>