Interface ArrayPool
- All Known Implementing Classes:
LruArrayPool
public interface ArrayPool
Interface for an array pool that pools arrays of different types.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA standard size to use to increase hit rates when the required size isn't defined. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears all arrays from the pool.<T> TReturns a non-null array of the given type with a length>=to the given size.<T> TReturns a non-null array of the given type with a length exactly equal to the given size.<T> voidput(T array) Optionally adds the given array of the given type to the pool.<T> voidDeprecated.voidtrimMemory(int level) Trims the size to the appropriate level.
-
Field Details
-
STANDARD_BUFFER_SIZE_BYTES
static final int STANDARD_BUFFER_SIZE_BYTESA standard size to use to increase hit rates when the required size isn't defined. Currently 64KB.- See Also:
-
-
Method Details
-
put
Deprecated.Useput(Object)Optionally adds the given array of the given type to the pool.Arrays may be ignored, for example if the array is larger than the maximum size of the pool.
-
put
<T> void put(T array) Optionally adds the given array of the given type to the pool.Arrays may be ignored, for example if the array is larger than the maximum size of the pool.
-
get
Returns a non-null array of the given type with a length>=to the given size.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.
- See Also:
-
getExact
Returns a non-null array of the given type with a length exactly equal to the given size.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.
- See Also:
-
clearMemory
void clearMemory()Clears all arrays from the pool. -
trimMemory
void trimMemory(int level) Trims the size to the appropriate level.- Parameters:
level- A trim specified inComponentCallbacks2.
-
put(Object)