STANDARD_BUFFER_SIZE_BYTES| Constructor and Description |
|---|
LruArrayPool() |
LruArrayPool(int maxSize)
Constructor for a new pool.
|
| 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.
|
public LruArrayPool()
public LruArrayPool(int maxSize)
maxSize - The maximum size in integers of the pool.public <T> void put(T array,
Class<T> arrayClass)
ArrayPoolArrays may be ignored, for example if the array is larger than the maximum size of the pool.
public <T> T get(int size,
Class<T> arrayClass)
ArrayPoolIf 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.
public void clearMemory()
ArrayPoolclearMemory in interface ArrayPoolpublic void trimMemory(int level)
ArrayPooltrimMemory in interface ArrayPoollevel - A trim specified in ComponentCallbacks2.