com.bumptech.glide.util
Class ByteArrayPool

java.lang.Object
  extended by com.bumptech.glide.util.ByteArrayPool

public final class ByteArrayPool
extends Object

A pool for reusing byte arrays that produces and contains byte arrays of a fixed size.


Method Summary
 void clear()
          Removes all byte arrays from the pool.
static ByteArrayPool get()
          Returns a constant singleton byte array pool.
 byte[] getBytes()
          Returns a byte array by retrieving one from the pool if the pool is non empty or otherwise by creating a new byte array.
 boolean releaseBytes(byte[] bytes)
          Adds the given byte array to the pool if it is the correct size and the pool is not full and returns true if the byte array was added and false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static ByteArrayPool get()
Returns a constant singleton byte array pool.


clear

public void clear()
Removes all byte arrays from the pool.


getBytes

public byte[] getBytes()
Returns a byte array by retrieving one from the pool if the pool is non empty or otherwise by creating a new byte array.


releaseBytes

public boolean releaseBytes(byte[] bytes)
Adds the given byte array to the pool if it is the correct size and the pool is not full and returns true if the byte array was added and false otherwise.

Parameters:
bytes - The bytes to try to add to the pool.