public class ResettableArrayCache extends ArrayCache
| Constructor and Description |
|---|
ResettableArrayCache(ArrayCache arrayCache)
Creates a new ResettableArrayCache based on the given ArrayCache.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getByteArray(int size,
boolean fillWithZeros)
Allocates a new byte array.
|
int[] |
getIntArray(int size,
boolean fillWithZeros)
Allocates a new int array.
|
void |
putArray(byte[] array)
Puts the given byte array to the cache.
|
void |
putArray(int[] array)
Puts the given int array to the cache.
|
void |
reset()
Puts all allocated arrays back to the underlying ArrayCache
that haven't already been put there with a call to
putArray. |
getDefaultCache, getDummyCache, setDefaultCachepublic ResettableArrayCache(ArrayCache arrayCache)
public byte[] getByteArray(int size,
boolean fillWithZeros)
ArrayCache
This implementation simply returns new byte[size].
getByteArray in class ArrayCachesize - the minimum size of the array to allocate;
an implementation may return an array that
is larger than the given sizefillWithZeros - if true, the caller expects that the first
size elements in the array are zero;
if false, the array contents can be anything,
which speeds things up when reusing a cached
arraypublic void putArray(byte[] array)
ArrayCacheThis implementation does nothing.
putArray in class ArrayCachepublic int[] getIntArray(int size,
boolean fillWithZeros)
ArrayCache
This implementation simply returns new int[size].
getIntArray in class ArrayCachesize - the minimum size of the array to allocate;
an implementation may return an array that
is larger than the given sizefillWithZeros - if true, the caller expects that the first
size elements in the array are zero;
if false, the array contents can be anything,
which speeds things up when reusing a cached
arraypublic void putArray(int[] array)
ArrayCacheThis implementation does nothing.
putArray in class ArrayCachepublic void reset()
putArray.