Use encode with an Object value where feasible

Closes gh-22782
This commit is contained in:
Rossen Stoyanchev
2019-04-11 18:56:54 -04:00
parent 181482fa15
commit 5fc18064f2
7 changed files with 69 additions and 106 deletions

View File

@@ -80,10 +80,14 @@ public class DefaultDataBuffer implements DataBuffer {
/**
* Directly exposes the native {@code ByteBuffer} that this buffer is based on.
* Directly exposes the native {@code ByteBuffer} that this buffer is based
* on also updating the {@code ByteBuffer's} position and limit to match
* the current {@link #readPosition()} and {@link #readableByteCount()}.
* @return the wrapped byte buffer
*/
public ByteBuffer getNativeBuffer() {
this.byteBuffer.position(this.readPosition);
this.byteBuffer.limit(readableByteCount());
return this.byteBuffer;
}