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> T |
getExact(int size,
Class<T> arrayClass)
Returns a non-null array of the given type with a length exactly equal to the given size.
|
<T> void |
put(T array)
Optionally adds the given array of the given type to the pool.
|
<T> void |
put(T array,
Class<T> arrayClass)
Deprecated.
|
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.@Deprecated 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> void put(T array)
ArrayPoolArrays may be ignored, for example if the array is larger than the maximum size of the pool.
public <T> T getExact(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.
getExact in interface ArrayPoolArrayPool.get(int, Class)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.
get in interface ArrayPoolArrayPool.getExact(int, Class)public void clearMemory()
ArrayPoolclearMemory in interface ArrayPoolpublic void trimMemory(int level)
ArrayPooltrimMemory in interface ArrayPoollevel - A trim specified in ComponentCallbacks2.