return true;\r
}\r
\r
- private static ByteBuffer ensureBufferSize(ByteBuffer buffer, int minCapacity) {\r
+ private ByteBuffer ensureBufferSize(ByteBuffer buffer, int minCapacity) {\r
int oldCapacity = buffer != null ? buffer.capacity() : 0;\r
if (buffer == null || oldCapacity < minCapacity) {\r
int newCapacity = grow(oldCapacity, minCapacity);\r
//System.out.println("ensureBufferSize(" + oldCapacity + ", " + minCapacity + "), new capacity " + newCapacity);\r
- buffer = ByteBuffer.allocateDirect(newCapacity);\r
+ buffer = allocateBuffer(newCapacity);\r
}\r
return buffer;\r
}\r
\r
+ protected ByteBuffer allocateBuffer(int capacity) {\r
+ return ByteBuffer.allocateDirect(capacity);\r
+ }\r
+ \r
/**\r
* @param oldCapacity current capacity of a buffer\r
* @param minCapacity\r