public class ByteArrayPool
extends java.lang.Object
| Constructor and Description |
|---|
ByteArrayPool() |
ByteArrayPool(boolean allocationThresholdEnabled) |
ByteArrayPool(int allocationThreshold) |
| Modifier and Type | Method and Description |
|---|---|
void |
returnArray(byte[] array)
Return a taken byte[] to the pool.
|
byte[] |
takeArray(int length)
Take a byte[] with the specified length from the pool, or returns a directly allocated one if length <=
allocationThreshold and allocationThresholdEnabled==true.
|
public ByteArrayPool()
public ByteArrayPool(boolean allocationThresholdEnabled)
public ByteArrayPool(int allocationThreshold)
public byte[] takeArray(int length)
length - Desired length.public void returnArray(byte[] array)
array - byte[] to return.