## net.i2p.util
Class ByteCache

    java.lang.Object
      net.i2p.util.ByteCache

    public final class ByteCache

extends java.lang.Object

Cache the objects frequently used to reduce memory churn. The ByteArray should be held onto as long as the data referenced in it is needed.

Method Summary
`ByteArray` `acquire()` Get the next available structure, either from the cache or a brand new one
`static ByteCache` `getInstance(int cacheSize, int size)` Get a cache responsible for objects of the given size
`void` `release(ByteArray entry)` Put this structure back onto the available cache for reuse
`void` `release(ByteArray entry, boolean shouldZero)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static ByteCache getInstance(int cacheSize,
                                        int size)

  Get a cache responsible for objects of the given size

  Parameters:
    `cacheSize` - how large we want the cache to grow before using on demand allocation
    `size` - how large should the objects cached be?

### acquire

    public final ByteArray acquire()

  Get the next available structure, either from the cache or a brand new one

### release

    public final void release(ByteArray entry)

  Put this structure back onto the available cache for reuse

### release

    public final void release(ByteArray entry,
                              boolean shouldZero)