Re: [JPP-Devel] endianess

2008-06-23 Thread Christopher
I currently have things staged as follows with each step dependent on the success of the previous step: 1. read in file tag and check for compatibility (currently 12bytes) 2. read in header fields that describe how many vertices, triangles, and breaklines follow (24 bytes) 3. read in vertices (n*2

Re: [JPP-Devel] endianess

2008-06-23 Thread Paul Austin
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 d

Re: [JPP-Devel] endianess

2008-06-23 Thread Christopher
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 t

Re: [JPP-Devel] endianess

2008-06-23 Thread Sunburned Surveyor
I would vote for big-endian as well Christopher. This was a good question. Landon On Mon, Jun 23, 2008 at 7:21 AM, 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 DataI

Re: [JPP-Devel] endianess

2008-06-23 Thread Paul Austin
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 d

Re: [JPP-Devel] endianess

2008-06-22 Thread Joe Desbonnet
Internet Protocol (IP) is big-endian which would be a big incentive to go that way. Joe. On Sun, Jun 22, 2008 at 5:46 AM, Christopher <[EMAIL PROTECTED]> wrote: > Should binary files created with OpenJUMP be big > endian or little endian? > > Big endian = java standard, PowerPC, RISC. > Little en

[JPP-Devel] endianess

2008-06-21 Thread Christopher
Should binary files created with OpenJUMP be big endian or little endian? Big endian = java standard, PowerPC, RISC. Little endian = x86. I don't have a preference as either would be equally easy (praise ByteBuffer), but we should have some sort of standard as it reduces strange bugs... --Christ