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.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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

    - #### acquire

          public static byte[] acquire(int size)

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

    - #### clearAll

          public static void clearAll()

      Clear everything (memory pressure)

    - #### 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?

    - #### release

          public static void release(byte[] entry)

      Put this array back onto the available cache for reuse