|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jouvieje.fmodex.utils.Pointer
A Pointer
object is used to holds a part of the memory.
It can be used to hold any kind of object: both general java object and native objects.
ACCESSING VALUE
To access the value store in the memory, you need to know which kind of object it holds.
Afterwards, create the appropriate view of the memory block.
For a String :
For a native object (with java wrapper named NativeObject) :
Pointer pointer;
String string = pointer.asString();
Warning :
Pointer pointer;
NativeObject nativeObject = NativeObject.asNativeObject(pointer);
If you create an inpropriate 'cast', the JVM (Java Virtual Machine) may crash !
Constructor Summary | |
Pointer()
Default constructor. |
Method Summary | |
java.nio.ByteBuffer |
asByteBuffer(int offsetInBytes,
int capacityInBytes)
Create a view of the Pointer object as a ByteBuffer object. |
double |
asDouble()
|
float |
asFloat()
|
int |
asInt()
|
long |
asLong()
|
Pointer |
asPointer(long offset)
|
java.lang.String |
asString()
Retrieve the String value stored in a Pointer (null terminated string). |
java.lang.String |
asString(int offset,
int length)
Retrieve the String value stored in the Pointer . |
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()
String
value stored in a Pointer
(null terminated string).
asString(int, int)
public java.lang.String asString(int offset, int length)
String
value stored in the Pointer
.
offset
- offset (in characters) from the current position in the Pointer
.length
- length of the String to retrieve.
Pointer
.#asString(Pointer
,
BufferUtils.toString(ByteBuffer, int, int)
public java.nio.ByteBuffer asByteBuffer(int offsetInBytes, int capacityInBytes)
Pointer
object as a ByteBuffer
object.
offsetInBytes
- offset in BYTEScapacityInBytes
- capacity in BYTES
public int asInt()
public long asLong()
public float asFloat()
public double asDouble()
public Pointer asPointer(long offset)
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 |