Class BufferCache


  • public class BufferCache
    extends java.lang.Object
    A wrapper for ByteBufferCache.
    • Constructor Summary

      Constructors 
      Constructor Description
      BufferCache()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Buffer getBuffer​(int sizeBuffer, boolean needsClearing)
      Obtains a Buffer of the specified size.
      static void initializeBuffers​(int sizeBuffer, int nrBuffers)
      Initializes the buffer cache with the specified number of buffers of the specified size.
      static void makeAvailableBuffer​(Buffer b)
      Make the specified Buffer available for use, that is, append it to the list of available buffers.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BufferCache

        public BufferCache()
    • Method Detail

      • makeAvailableBuffer

        public static void makeAvailableBuffer​(Buffer b)
        Make the specified Buffer available for use, that is, append it to the list of available buffers.
        Parameters:
        b - a Buffer value
      • getBuffer

        public static Buffer getBuffer​(int sizeBuffer,
                                       boolean needsClearing)
        Obtains a Buffer of the specified size. If one cannot be found in the cache, a new one is allocated. If it needs to be clear(ed), the needsClearing flag should be set to true.
        Parameters:
        sizeBuffer - the size of the Buffer to be obtained
        needsClearing - whether the Buffer needs to be cleared
        Returns:
        the obtained Buffer
      • initializeBuffers

        public static void initializeBuffers​(int sizeBuffer,
                                             int nrBuffers)
        Initializes the buffer cache with the specified number of buffers of the specified size.
        Parameters:
        sizeBuffer - the size of the buffers
        nrBuffers - the number of buffers that need to be initialized