Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8218931

(bf) NewDirectByteBuffer always has order ByteOrder.BIG_ENDIAN

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P5 P5
    • 13
    • core-libs
    • None
    • behavioral
    • minimal
    • This is an update to the JNI specification to match longstanding behavior so should not present any compatibility issues.
    • Java API
    • SE

      Summary

      Change NewDirectByteBuffer JNI specification to match that of java.nio.ByteBuffer.allocateDirect() and its longstanding behavior.

      Problem

      NewDirectByteBuffer does not specify that the direct ByteBuffer object it constructs has byte order java.nio.ByteOrder.BIG_ENDIAN.

      Solution

      Update the NewDirectByteBuffer JNI specification verbiage.

      Specification

      --- a/closed/src/java.se/share/specs/jni/functions.md
      +++ b/closed/src/java.se/share/specs/jni/functions.md
      @@ -3610,10 +3610,12 @@
      
       `jobject NewDirectByteBuffer(JNIEnv* env, void* address, jlong capacity);`
      
       Allocates and returns a direct `java.nio.ByteBuffer` referring to the block of
       memory starting at the memory address `address` and extending `capacity` bytes.
      +The byte order of the returned buffer is always big-endian (high byte first; 
      +`java.nio.ByteOrder.BIG_ENDIAN`).
      

            bpb Brian Burkhalter
            rmandalasunw Ranjith Mandala (Inactive)
            Alan Bateman, Brent Christian, Lance Andersen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: