-
- All Implemented Interfaces:
-
com.mobwith.imgmodule.load.engine.bitmap_recycle.ArrayPool
public final class LruArrayPool implements ArrayPool
A fixed size Array Pool that evicts arrays using an LRU strategy to keep the pool under the maximum byte size.
-
-
Constructor Summary
Constructors Constructor Description LruArrayPool()LruArrayPool(int maxSize)Constructor for a new pool.
-
Method Summary
Modifier and Type Method Description <T> voidput(T array, Class<T> arrayClass)Optionally adds the given array of the given type to the pool. synchronized <T> voidput(T array)Optionally adds the given array of the given type to the pool. synchronized <T> TgetExact(int size, Class<T> arrayClass)Returns a non-null array of the given type with a length exactly equal to the given size. synchronized <T> Tget(int size, Class<T> arrayClass)Returns a non-null array of the given type with a length >= to the given size. synchronized voidclearMemory()Clears all arrays from the pool. synchronized voidtrimMemory(int level)Trims the size to the appropriate level. -
-
Method Detail
-
put
@Deprecated() <T> void put(T array, Class<T> arrayClass)
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
synchronized <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.
-
getExact
synchronized <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.
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
synchronized <T> T get(int size, Class<T> arrayClass)
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.
-
clearMemory
synchronized void clearMemory()
Clears all arrays from the pool.
-
trimMemory
synchronized void trimMemory(int level)
Trims the size to the appropriate level.
- Parameters:
level- A trim specified in android.content.ComponentCallbacks2.
-
-
-
-