Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions common/src/main/java/org/conscrypt/BufferAllocator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
};

/**
Expand All @@ -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);
}
Loading