Details
-
Improvement
-
Resolution: Unresolved
-
Major - P3
-
None
-
2.7.0
-
None
-
Fully Compatible
Description
I'd like to reuse one allocated buffer to read and one buffer to write to the mongodb. Currently one must use WriteBytes(byte[]) and byte[] ReadBytes() to read and write byte arrays. These arrays must be pre allocated with the correct size.
If you want to reuse a buffer it would be nice to get some overloads with a size restriction like:
void IBsonWriter.WriteBytes(byte[] bytes, int size);
This overload should only write size bytes to the document.
void IBsonWriter.ReadBytes(byte[] buffer, int offset, int size);
This overload should only fill the count of bytes defined by size starting at offset.
This would reduce memory fragmentation in the program.