Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The read methods (readByte(), readShort(), readInt(), readLong(), readFloat(), and readDouble()) and the corresponding write methods defined by class java.io.DataInputStream and class java.io.DataOutputStream operate only on big-endian data. Use of these methods while interoperating with traditional languages, such as C or and C++, is insecure because such languages lack any guarantees about endianness. This noncompliant code example shows such a discrepancy:

...

[API 2014]

Class ByteBuffer
   Methods Method wrap() and
   Method order()
Class Integer
   Method reverseBytes()

[Cohen 1981]

"On Holy Wars and a Plea for Peace"

[Harold 1997]

Chapter 2, "Primitive Data Types, Cross-Platform Issues"

...