|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jouvieje.bass.misc.Pointer
A Pointer
object is used to holds a part of the memory.
This object is used to store any kind of objects. For example, we can store an array, a Java Object, a BASS object ...
ACCESSING VALUE
To access the value store in the memory, you need to know which kind of object is holded.
Then, you need to creates an appropriate view of the memory block holded.
In this example, the Pointer
object holds a String
:
The object can also store an BASS object. For example a Sound :
Pointer pointer = ...; //Object already created that store a String
String string = PointerUtils.toString(pointer);
Warning :
Pointer pointer = ...; //Object already created that store a Sound
Sound sound = Sound.createView(pointer);
If you create and use an invalide view , the JVM (Java Virtual Machine) can crash without any warning !
Constructor Summary | |
Pointer()
Default constructor. |
Method Summary | |
double |
asDouble()
|
float |
asFloat()
|
int |
asInt()
|
long |
asLong()
|
java.lang.String |
asString()
This should only be used if you are sure that this object contains a String value. |
boolean |
equals(java.lang.Object object)
Use to know if two object are equals. |
boolean |
isNull()
|
void |
shareMemory(Pointer source)
Share the same memory region that the Pointer object passed as parameter. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Pointer()
isNull()
will return true
.
Method Detail |
public java.lang.String asString()
PointerUtils.toString(this)
this.isNull()
equals true.public int asInt()
public long asLong()
public float asFloat()
public double asDouble()
public boolean equals(java.lang.Object object)
Sound sound1, sound2;
...
if(sound1 == sound2)
{
...
Use this :
Sound sound1, sound2;
...
if(sound1.equals(sound2))
{
...
public boolean isNull()
public void shareMemory(Pointer source)
Pointer
object passed as parameter.
source
- a Pointer
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |