@ThreadSafe public final class ByteArrayIOPool extends Object implements IOPool<ByteArrayIOEntry>
| Modifier and Type | Class and Description |
|---|---|
class |
ByteArrayIOPool.Entry |
Pool.Releasable<E extends Exception>| Modifier and Type | Field and Description |
|---|---|
private int |
active |
private int |
initialCapacity |
private static String |
MOCK_ENTRY_NAME |
private int |
total |
| Constructor and Description |
|---|
ByteArrayIOPool()
Equivalent to
new ByteArrayIOPool(32). |
ByteArrayIOPool(int initialCapacity)
Constructs a new byte array I/O pool.
|
| Modifier and Type | Method and Description |
|---|---|
ByteArrayIOPool.Entry |
allocate()
Allocates a resource from this pool.
|
int |
getSize()
Returns the number of I/O entries allocated but not yet released from
this pool.
|
void |
release(IOPool.Entry<ByteArrayIOEntry> entry)
Releases a previously allocated resource to this pool.
|
private static final String MOCK_ENTRY_NAME
private final int initialCapacity
private volatile int total
private volatile int active
public ByteArrayIOPool()
new ByteArrayIOPool(32).public ByteArrayIOPool(int initialCapacity)
initialCapacity - the initial capacity of the array to use for
writing to an allocated I/O entry.public ByteArrayIOPool.Entry allocate()
PoolMind that a pool implementation should not hold references to its allocated resources because this could cause a memory leak.
allocate in interface Pool<IOPool.Entry<ByteArrayIOEntry>,IOException>public void release(IOPool.Entry<ByteArrayIOEntry> entry) throws IOException
PoolIllegalArgumentException or an
IllegalStateException upon the conditions explained below.release in interface Pool<IOPool.Entry<ByteArrayIOEntry>,IOException>entry - a resource.IOExceptionpublic int getSize()
Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.