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> 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.
Use
put(Object) |
void |
trimMemory(int level)
Trims the size to the appropriate level.
|
static final int STANDARD_BUFFER_SIZE_BYTES
@Deprecated <T> void put(T array, Class<T> arrayClass)
put(Object)
Arrays may be ignored, for example if the array is larger than the maximum size of the pool.
<T> void put(T array)
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.
getExact(int, Class)
<T> T getExact(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.
get(int, Class)
void clearMemory()
void trimMemory(int level)
level
- A trim specified in ComponentCallbacks2
.