org.xith3d.utility.memory
Class NioMemoryBuffer<T>

java.lang.Object
  extended by org.xith3d.utility.memory.NioMemoryBuffer<T>
All Implemented Interfaces:
org.jagatoo.datatypes.NamedObject, Cachable<T>

public class NioMemoryBuffer<T>
extends java.lang.Object
implements Cachable<T>

Cached NIO buffer system.


Method Summary
 void flush(T o)
          Called if the cache determines that the object should be flushed through non-use.
 byte[] getByteArray()
           
 java.nio.FloatBuffer getFloatBuffer()
           
static NioMemoryBuffer<?> getInstance(int size)
           
 java.nio.IntBuffer getIntBuffer()
           
 java.lang.String getName()
           
 long memoryUsed()
           
 void returnInstance()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static NioMemoryBuffer<?> getInstance(int size)

returnInstance

public void returnInstance()

size

public int size()

getByteArray

public byte[] getByteArray()

getFloatBuffer

public java.nio.FloatBuffer getFloatBuffer()

getIntBuffer

public java.nio.IntBuffer getIntBuffer()

memoryUsed

public long memoryUsed()
Specified by:
memoryUsed in interface Cachable<T>
Returns:
an approximate amount of memory being used by the cached item.

flush

public void flush(T o)
Called if the cache determines that the object should be flushed through non-use. This should only be called be the caching system if check in and check out are strictly managed. The the implementation does nothing in this function then the object will be garbaged collected.

Specified by:
flush in interface Cachable<T>
Parameters:
o -

getName

public java.lang.String getName()
Specified by:
getName in interface org.jagatoo.datatypes.NamedObject
Specified by:
getName in interface Cachable<T>
Returns:
the name of the cached object. Returning NULL is acceptable. This is primarily used for reporting and tracking cached items.