Пример #1
0
  private void ensureCapacity(int capacity) {
    if (capacity <= buffer.capacity()) return;

    ByteBuffer resized = BufferUtils.createAlignedByteBufferPage(mathRoundPoT(capacity));

    resized.put(buffer);
    resized.clear();

    buffer = resized;
    address = memAddress(resized);
  }
Пример #2
0
 public APIBuffer() {
   buffer = BufferUtils.createAlignedByteBufferPage(DEFAULT_CAPACITY);
   address = memAddress(buffer);
 }