/** * Allocates a buffer of at least the size requested. * <p/> * Keep in mind that the capacity of the buffer may be greater than the * allocation request. The limit however, will be set to the specified * size. The memory beyond the limit, is available for use. * * @param size the min {@link Buffer} size to be allocated. * @return a buffer with a limit of the specified <tt>size</tt>. */ @Override public Buffer allocateAtLeast(int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } if (size == 0) { return Buffers.EMPTY_BUFFER; } return size <= maxPooledBufferSize ? getPoolFor(size).allocate() : allocateToCompositeBuffer(newCompositeBuffer(), size); }
/** * Allocates a buffer of at least the size requested. * <p/> * Keep in mind that the capacity of the buffer may be greater than the * allocation request. The limit however, will be set to the specified * size. The memory beyond the limit, is available for use. * * @param size the min {@link Buffer} size to be allocated. * @return a buffer with a limit of the specified <tt>size</tt>. */ @Override public Buffer allocateAtLeast(int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } if (size == 0) { return Buffers.EMPTY_BUFFER; } return size <= maxPooledBufferSize ? getPoolFor(size).allocate() : allocateToCompositeBuffer(newCompositeBuffer(), size); }
/** * Allocates a buffer of at least the size requested. * <p/> * Keep in mind that the capacity of the buffer may be greater than the * allocation request. The limit however, will be set to the specified * size. The memory beyond the limit, is available for use. * * @param size the min {@link Buffer} size to be allocated. * @return a buffer with a limit of the specified <tt>size</tt>. */ @Override public Buffer allocateAtLeast(int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } if (size == 0) { return Buffers.EMPTY_BUFFER; } return size <= maxPooledBufferSize ? getPoolFor(size).allocate() : allocateToCompositeBuffer(newCompositeBuffer(), size); }
/** * Allocates a buffer of at least the size requested. * <p/> * Keep in mind that the capacity of the buffer may be greater than the * allocation request. The limit however, will be set to the specified * size. The memory beyond the limit, is available for use. * * @param size the min {@link Buffer} size to be allocated. * @return a buffer with a limit of the specified <tt>size</tt>. */ @Override public Buffer allocateAtLeast(int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } if (size == 0) { return Buffers.EMPTY_BUFFER; } return size <= maxPooledBufferSize ? getPoolFor(size).allocate() : allocateToCompositeBuffer(newCompositeBuffer(), size); }
/** * Allocates a buffer of at least the size requested. * <p/> * Keep in mind that the capacity of the buffer may be greater than the * allocation request. The limit however, will be set to the specified * size. The memory beyond the limit, is available for use. * * @param size the min {@link Buffer} size to be allocated. * @return a buffer with a limit of the specified <tt>size</tt>. */ @Override public Buffer allocateAtLeast(int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } if (size == 0) { return Buffers.EMPTY_BUFFER; } return size <= maxPooledBufferSize ? getPoolFor(size).allocate() : allocateToCompositeBuffer(newCompositeBuffer(), size); }
/** * Allocates a buffer of at least the size requested. * <p/> * Keep in mind that the capacity of the buffer may be greater than the * allocation request. The limit however, will be set to the specified * size. The memory beyond the limit, is available for use. * * @param size the min {@link Buffer} size to be allocated. * @return a buffer with a limit of the specified <tt>size</tt>. */ @Override public Buffer allocateAtLeast(int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } if (size == 0) { return Buffers.EMPTY_BUFFER; } return size <= maxPooledBufferSize ? getPoolFor(size).allocate() : allocateToCompositeBuffer(newCompositeBuffer(), size); }
/** * Allocates a buffer of at least the size requested. * <p/> * Keep in mind that the capacity of the buffer may be greater than the * allocation request. The limit however, will be set to the specified * size. The memory beyond the limit, is available for use. * * @param size the min {@link Buffer} size to be allocated. * @return a buffer with a limit of the specified <tt>size</tt>. */ @Override public Buffer allocateAtLeast(int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } if (size == 0) { return Buffers.EMPTY_BUFFER; } return size <= maxPooledBufferSize ? getPoolFor(size).allocate() : allocateToCompositeBuffer(newCompositeBuffer(), size); }
/** * Allocates a buffer of at least the size requested. * <p/> * Keep in mind that the capacity of the buffer may be greater than the * allocation request. The limit however, will be set to the specified * size. The memory beyond the limit, is available for use. * * @param size the min {@link Buffer} size to be allocated. * @return a buffer with a limit of the specified <tt>size</tt>. */ @Override public Buffer allocateAtLeast(int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } if (size == 0) { return Buffers.EMPTY_BUFFER; } return size <= maxPooledBufferSize ? getPoolFor(size).allocate() : allocateToCompositeBuffer(newCompositeBuffer(), size); }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }
private CompositeBuffer allocateToCompositeBuffer( final CompositeBuffer cb, int size) { assert size >= 0; if (size >= maxPooledBufferSize) { final Pool maxBufferSizePool = pools[pools.length - 1]; do { cb.append(maxBufferSizePool.allocate()); size -= maxPooledBufferSize; } while (size >= maxPooledBufferSize); } for (int i = 0; i < pools.length; i++) { final Pool pool = pools[i]; if (pool.bufferSize >= size) { final Buffer b = pool.allocate(); cb.append(b.limit(size)); break; } } return cb; }