How to extract a double from a little endian stream?
807569May 31 2006 — edited May 31 2006I want to support Java 1.3.1, which means that I cannot use class ByteBuffer.
I would need ByteBuffer with the methods order and getDouble.
I read the socket in little endian format (thus I cannot use the getDouble method of the class DataInputStream). Is there any solution in Java 1.3.1 to extract a double from 8 bytes?
In other words, if I want to keep my code compatiple with Java 1.3.1, do I have to change the order of the bytes manually and then also extract the double value manually (extracting the sign-bit, the exponent and significant to calculate the double value is possible but quite stupid if there is another way...)
It would also help to have the release notes for Java 1.4.2. ( the link on the SUN pages points to nowhere). I am especially interested in the history of the development of ByteBuffer. Did the functionality of order (LITTLE_ENDIAN / BIG_ENDIAN) exist in any other way in Java 1.3.1?
Ps. I put another case to this Forum earlier today, and even added it to my watch list, and even got an answer BUT after relogin there was not even a sign of that case... I sent feedback to SUN but I'm sorry for not being able to get back to the person who answered my case.