> appropriate thing in Java --- I was under the impression that Java tried
> to hide hardware details like endianness, so there may be some
> convention about how you turn a sequence of bytes into a native integer.
Java tried so hard to hide endianness from you that it didn't provide
any real support for those times when you DO need to be aware of it. So
the "convention" looks kind of like this (snipped from the PG JDBC
driver):
public void SendInteger4(int val) throws IOException
{
SendChar((val >> 24)&255);
SendChar((val >> 16)&255);
SendChar((val >> 8)&255);
SendChar(val&255);
}
There finally were endian-aware buffer operations added in JDK 1.4, but
using them would be a big code change and would make the driver
unavailable for users of antique JVM's.
-- Mark