org.xith3d.utility.memory
Class NioMemoryBuffer<T>
java.lang.Object
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.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.