Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.i2p.util
Class SimpleByteCache

    java.lang.Object
      net.i2p.util.SimpleByteCache

    public final class SimpleByteCache

extends Object

Like ByteCache but works directly with byte arrays, not ByteArrays. These are designed to be small caches, so there's no cleaner task like there is in ByteCache. And we don't zero out the arrays here. Only the static methods are public here.

Since:
  0.8.3

Method Summary
`static byte[]` | `acquire(int size)` Get the next available array, either from the cache or a brand new one
`static void` | `clearAll()` Clear everything (memory pressure)
`static SimpleByteCache` | `getInstance(int size)` Get a cache responsible for arrays of the given size
`static SimpleByteCache` | `getInstance(int cacheSize, int size)` Get a cache responsible for objects of the given size
`static void` | `release(byte[] entry)` Put this array back onto the available cache for reuse

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

Method Detail

### getInstance

    public static SimpleByteCache getInstance(int size)

  Get a cache responsible for arrays of the given size

  Parameters:
    `size` - how large should the objects cached be?

### getInstance

    public static SimpleByteCache 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 (number of objects, NOT memory size) before discarding released objects.
    `size` - how large should the objects cached be?

### clearAll

    public static void clearAll()

  Clear everything (memory pressure)

### acquire

    public static byte[] acquire(int size)

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

### release

    public static void release(byte[] entry)

  Put this array back onto the available cache for reuse

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD