Package com.jme3.util

Class ReflectionAllocator

java.lang.Object
com.jme3.util.ReflectionAllocator
All Implemented Interfaces:
BufferAllocator

public final class ReflectionAllocator extends Object implements BufferAllocator
This class contains the reflection based way to remove DirectByteBuffers in java, allocation is done via ByteBuffer.allocateDirect
  • Constructor Details

    • ReflectionAllocator

      public ReflectionAllocator()
  • Method Details

    • destroyDirectBuffer

      public void destroyDirectBuffer(Buffer toBeDestroyed)
      This function explicitly calls the Cleaner method of a direct buffer.
      Specified by:
      destroyDirectBuffer in interface BufferAllocator
      Parameters:
      toBeDestroyed - The direct buffer that will be "cleaned". Utilizes reflection.
    • allocate

      public ByteBuffer allocate(int size)
      Description copied from interface: BufferAllocator
      Allocate a direct ByteBuffer of the specified size.
      Specified by:
      allocate in interface BufferAllocator
      Parameters:
      size - in bytes (≥0)
      Returns:
      a new direct buffer