/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
/** * For this implementation, this method simply calls through to * {@link #allocateAtLeast(int)}; */ @Override public Buffer allocate(final int size) { if (size < 0) { throw new IllegalArgumentException("Requested allocation size must be greater than or equal to zero."); } return allocateAtLeast(size).limit(size); }
@Test public void testIllegalAllocationArgument() throws Exception { PooledMemoryManager mm = new PooledMemoryManager(DEFAULT_BASE_BUFFER_SIZE, 1, 0, 1, DEFAULT_HEAP_USAGE_PERCENTAGE, DEFAULT_PREALLOCATED_BUFFERS_PERCENTAGE, isDirect); // allocation request must be greater than zero try { mm.allocate(-1); fail(); } catch (IllegalArgumentException iae) { // expected } catch (Exception e) { fail(); } try { mm.allocateAtLeast(-1); fail(); } catch (IllegalArgumentException iae) { // expected } catch (Exception e) { fail(); } }