public class ByteArrayPoolImpl extends AbstractPool<byte[]> implements ByteArrayPool
Pool
interface for byte-arrays.Modifier and Type | Field and Description |
---|---|
private int |
arrayLength
The actual length of the byte-arrays.
|
static int |
DEFAULT_ARRAY_LENGTH
The default array length.
|
DEFAULT_CAPACITY
Constructor and Description |
---|
ByteArrayPoolImpl()
The constructor.
|
ByteArrayPoolImpl(int capacity,
int arrayLength)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
create()
This method creates a new element.
|
protected boolean |
reset(byte[] element)
This method resets the given
element so it can be reused. |
borrow, clear, getCapacity, getSize, isEmpty, release
public static final int DEFAULT_ARRAY_LENGTH
private final int arrayLength
public ByteArrayPoolImpl()
public ByteArrayPoolImpl(int capacity, int arrayLength)
capacity
- is the capacity
of the pool.arrayLength
- is the length of each pooled byte-array.protected byte[] create()
AbstractPool
create
in class AbstractPool<byte[]>
protected boolean reset(byte[] element)
AbstractPool
element
so it can be reused. It is called if an element is
released
and will be stored in the pool. The implementation depends on the type of
element. Some types may become inconsistent if they are directly reused. Further this method may clear data from
the element for security reasons, because the same instance may be given to some other component that is NOT
trusted enough (because it may be vulnerably).reset
in class AbstractPool<byte[]>
element
- the element to reset.true
if the given element
can be reused and should be added to the pool, false
otherwise.Copyright © 2001–2016 mmm-Team. All rights reserved.