[JAVA-2300] Add conversions between ObjectId and ByteBuffer Created: 06/Sep/16  Updated: 27/Nov/16  Resolved: 13/Oct/16

Status: Closed
Project: Java Driver
Component/s: BSON
Affects Version/s: None
Fix Version/s: 3.4.0

Type: New Feature Priority: Minor - P4
Reporter: Tom Dyas Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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



 Comments   
Comment by Githook User [ 13/Oct/16 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-2300: Conform to coding standards

Replace conditonal logic with calls to Assertions.notNull and Assertions.isTrueArgument
Add @since javadoc annotations to new methods
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/f18c025181d5be584b5eafbfbaf6f7edc71417f3

Comment by Githook User [ 13/Oct/16 ]

Author:

{u'username': u'tdyas', u'name': u'Tom Dyas', u'email': u'tdyas@foursquare.com'}

Message: JAVA-2300: add conversions of ObjectId to/from java.nio.ByteBuffer

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.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/53e7e9b502b3292af55ea41255957870e157b71d

Comment by Jeffrey Yemin [ 12/Oct/16 ]

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

Comment by Tom Dyas [ 07/Oct/16 ]

Any response to this feature? It links to a PR with tests.

Generated at Thu Feb 08 08:56:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.