public interface ArrayPool
Modifier and Type | Field and Description |
---|---|
static int |
STANDARD_BUFFER_SIZE_BYTES
A standard size to use to increase hit rates when the required size isn't defined.
|
Modifier and Type | Method and Description |
---|---|
void |
clearMemory()
Clears all arrays from the pool.
|
<T> T |
get(int size,
Class<T> arrayClass)
Returns a non-null array of the given type with a length >= to the given size.
|
<T> void |
put(T array,
Class<T> arrayClass)
Optionally adds the given array of the given type to the pool.
|
void |
trimMemory(int level)
Trims the size to the appropriate level.
|
static final int STANDARD_BUFFER_SIZE_BYTES
<T> void put(T array, Class<T> arrayClass)
Arrays may be ignored, for example if the array is larger than the maximum size of the pool.
<T> T get(int size, Class<T> arrayClass)
If an array of the given size isn't in the pool, a new one will be allocated.
This class makes no guarantees about the contents of the returned array.
void clearMemory()
void trimMemory(int level)
level
- A trim specified in ComponentCallbacks2
.