protected final void ensureCapacity(int amount) { int remainingSpace = this.buffer.capacity() - this.buffer.position(); if (amount > remainingSpace) { expand(amount); } }
private final void ensureCapacity(int amount) { int remainingSpace = this.buffer.capacity() - this.buffer.position(); if (amount > remainingSpace) { expand(amount); } }
@Override protected final void expand(int amount) { Misc.checkMemoryRuntime(thresholdListener, query, amount); super.expand(amount); } }
@Override protected final void expand(int amount) { Misc.checkMemoryRuntime(thresholdListener, query, amount); super.expand(amount); }
@Override protected final void expand(int amount) { Misc.checkMemoryRuntime(thresholdListener, query, amount); super.expand(amount); }
public final void writeWithByteBufferWrappedConditionally(ByteBuffer source) { if (this.ignoreWrites) return; checkIfWritable(); final int len = source.remaining(); // Asif: // let us expand first so that current byte buffer goes into the list // and a new current byte buffer is created. We than place the wrapped // ByteBuffer into the list if (this.buffer.position() == 0) { // nothing in current buffer so just push the new one if (this.chunks == null) { this.chunks = new LinkedList<>(); } } else { this.expand(MIN_CHUNK_SIZE); } // Hide this buffer in the linked list so that it is not used for any // further writes as we want it to be immutable & it is possible that // capacity is > limit // i.e len does not cover the end of the source. this.chunks.add(source); // mark this chunk as non-reusable if (this.nonReusableChunks != null) { this.nonReusableChunks.set(this.chunks.size() - 1); } this.size += len; }
this.expand(MIN_CHUNK_SIZE);