diff --git a/common/src/main/java/org/conscrypt/BufferAllocator.java b/common/src/main/java/org/conscrypt/BufferAllocator.java index c3d6d8725..55fb685e6 100644 --- a/common/src/main/java/org/conscrypt/BufferAllocator.java +++ b/common/src/main/java/org/conscrypt/BufferAllocator.java @@ -28,6 +28,11 @@ public abstract class BufferAllocator { public AllocatedBuffer allocateDirectBuffer(int capacity) { return AllocatedBuffer.wrap(ByteBuffer.allocateDirect(capacity)); } + + @Override + public AllocatedBuffer allocateHeapBuffer(int capacity) { + return AllocatedBuffer.wrap(ByteBuffer.allocate(capacity)); + } }; /** @@ -41,4 +46,9 @@ public static BufferAllocator unpooled() { * Allocates a direct (i.e. non-heap) buffer with the given capacity. */ public abstract AllocatedBuffer allocateDirectBuffer(int capacity); + + /** + * Allocates a heap buffer with the given capacity. + */ + public abstract AllocatedBuffer allocateHeapBuffer(int capacity); }