| 限定符和类型 | 字段和说明 |
|---|---|
protected static java.util.Comparator<byte[]> |
BUF_COMPARATOR
Compares buffers by size
|
| 构造器和说明 |
|---|
ByteArrayPool(int sizeLimit) |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
acquire(int len)
Returns a buffer from the pool if one is available in the requested size, or allocates a new
one if a pooled one is not available.
|
void |
clearMemory()
Evict all items from the memory cache.
|
boolean |
release(byte[] buf)
Returns a buffer to the pool, throwing away old buffers if the pool would exceed its allotted
size.
|
void |
trimMemory(int level)
Trim the memory cache to the appropriate level.
|
protected static final java.util.Comparator<byte[]> BUF_COMPARATOR
public ByteArrayPool(int sizeLimit)
sizeLimit - the maximum size of the pool, in bytespublic byte[] acquire(int len)
public boolean release(byte[] buf)
public void clearMemory()
ArrayPoolclearMemory 在接口中 ArrayPool<byte[]>public void trimMemory(int level)
ArrayPooltrimMemory 在接口中 ArrayPool<byte[]>level - This integer represents a trim level as specified in ComponentCallbacks2.