Christopher,
Are you wrapping a large buffer (e.g. 4kb) or are you wrapping each
series of bytes (e.g. 8 bytes for a long). If you are doing the second
way, wrapping in a ByteBuffer will be inefficient compared with
DataInputStream.readLong(). As it has to first allocate the buffer and
then do the actual creation of the long, where as the DataInputStream
just takes each byte and does some shifts and adds.
Paul
Christopher wrote:
The way I am currently using ByteBuffer, I can deal
with any InputStream or OutputStream and switch
endianess by changing two static final variables
(BYTE_ORDER and CHAR_SET). Using a byte array to read
to and write from the stream, I just do a
ByteBuffer.wrap(byteArray).order(BYTE_ORDER) to make
things ordered the way I want. I've tested this with
both Big and Little Endian ordering and seems to work
just fine.
--Christopher
--- Paul Austin <[EMAIL PROTECTED]> wrote:
I would use big endian as it's the Java standard.
This would then make
it easier to read/write the files from
Input/outputStream (see
DataInputStream) as ByteBuffer would only allow you
to do the endian
conversion for file access. You may want to use an
Input/outputStream
stream to read/write data in a web service.
Paul
*Paul Austin*
/President/CEO/
Revolution Systems Inc.
+1 (604) 288-4304 x201
www.revolsys.com <http://www.revolsys.com>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel