Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2300

Add conversions between ObjectId and ByteBuffer

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.4.0
    • Affects Version/s: None
    • Component/s: BSON

      Add conversions to/from java.nio.ByteBuffer via the new putToByteBuffer method and a new constructor. This is useful for users who want to avoid the GC overhead of allocating a byte array when serializing an ObjectId to bytes.

      A good example of where this is useful is when serializing or deserializing an ObjectId within a larger ByteBuffer where it does not make sense to allocate a byte array for the sole purpose of extracting the ObjectId from the larger buffer.

      Pull Request: https://github.com/mongodb/mongo-java-driver/pull/368

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            tdyas4sq Tom Dyas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: