public final class ByteArrayPool extends Object
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all byte arrays from the pool.
|
static ByteArrayPool |
get()
Returns a constant singleton byte array pool.
|
byte[] |
getBytes()
Returns a byte array by retrieving one from the pool if the pool is non empty or otherwise by creating a new
byte array.
|
boolean |
releaseBytes(byte[] bytes)
Adds the given byte array to the pool if it is the correct size and the pool is not full and returns true if
the byte array was added and false otherwise.
|
public static ByteArrayPool get()
public void clear()
public byte[] getBytes()
public boolean releaseBytes(byte[] bytes)
bytes
- The bytes to try to add to the pool.