org.jouvieje.bass.misc
Class ObjectPointer
java.lang.Object
org.jouvieje.bass.misc.Pointer
org.jouvieje.bass.misc.ObjectPointer
- public class ObjectPointer
- extends Pointer
Container of a Java Object stored in the memory.
This class is typicaly used to pass any Java objects to BASS (throw a callback as the userdata parameter ...)
Look at RipNetStreamBis
to have an exemple of its use.
ACCESSING VALUE
If you want to access the Object store in ObjectPointer
, use something like this :
float[] array = ...; //float[] already created
ObjectPointer objectPointer = new ObjectPointer(array);
...
//Use a cast
float[] arrayPointed = (float[])objectPointer.getObject();
CLEANING
The Object stored is not deleted automatically by the Garbage Collector
.
To delete it, you have to call release
on ObjectPointer
.
Constructor Summary |
ObjectPointer()
Create an object that holds a null ObjectPointer . |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ObjectPointer
public ObjectPointer()
- Create an object that holds a null
ObjectPointer
.
The call isNull()
on the object created will returns true.
ObjectPointer obj = new ObjectPointer();
(obj == null) <=> false
obj.isNull() <=> true
To creates a new ObjectPointer
, use the static "constructor" :
ObjectPointer obj = ObjectPointer.create();
- See Also:
create(Object)
createView
public static ObjectPointer createView(Pointer pointer)
- Create a view of the
Pointer
as a ObjectPointer
object.
This view is valid only if the memory holded by the Pointer
holds an Object
.
create
public static ObjectPointer create(java.lang.Object obj)
- Create a new
ObjectPointer
.
The call isNull()
on the object created will return false.
BASS_3DVECTOR obj = BASS_3DVECTOR.create();
(obj == null) <=> obj.isNull() <=> false
release
public void release()
getValue
public java.lang.Object getValue()
- Returns:
- the object stored in the memory
getObject
public java.lang.Object getObject()
- Returns:
- the object stored in the memory
setObject
public void setObject(java.lang.Object obj)
- Parameters:
obj
- object to store in the memory.
NativeBass is an Open Source Project under GNU LGPL License
NativeBass Project - © Copyright 2007-2008 - Jérôme Jouvie (Jouvieje)
http://jerome.jouvie.free.fr/ - jerome.jouvie@gmail.com
(Documentation Copyright © Ian Luck - BASS - http://www.un4seen.com)