-
Type: New Feature
-
Resolution: Done
-
Priority: Minor - P4
-
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