org.jouvieje.fmodex.utils
Class Pointer

java.lang.Object
  extended byorg.jouvieje.fmodex.utils.Pointer
Direct Known Subclasses:
Channel, ChannelGroup, DSP, DSPConnection, Event, EventCategory, EventGroup, EventParameter, EventProject, EventQueue, EventQueueEntry, EventReverb, EventSystem, FMOD_ADVANCEDSETTINGS, FMOD_ASYNCREADINFO, FMOD_CDTOC, FMOD_CODEC_DESCRIPTION, FMOD_CODEC_STATE, FMOD_CODEC_WAVEFORMAT, FMOD_CREATESOUNDEXINFO, FMOD_DSP_DESCRIPTION, FMOD_DSP_PARAMETERDESC, FMOD_DSP_STATE, FMOD_EVENT_INFO, FMOD_EVENT_LOADINFO, FMOD_EVENT_SOUNDDEFINFO, FMOD_EVENT_SYSTEMINFO, FMOD_EVENT_WAVEBANKINFO, FMOD_GUID, FMOD_MEMORY_USAGE_DETAILS, FMOD_MUSIC_ENTITY, FMOD_MUSIC_INFO, FMOD_MUSIC_ITERATOR, FMOD_MUSIC_SAMPLE_INFO, FMOD_REVERB_CHANNELPROPERTIES, FMOD_REVERB_PROPERTIES, FMOD_SYNCPOINT, FMOD_TAG, FMOD_VECTOR, FmodDesigner, FmodEx, Geometry, MusicPrompt, MusicSystem, ObjectPointer, Reverb, Sound, SoundGroup, System

public class Pointer
extends java.lang.Object

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 :

 Pointer pointer;
 String string = pointer.asString();
 
For a native object (with java wrapper named NativeObject) :
 Pointer pointer;
 NativeObject nativeObject = NativeObject.asNativeObject(pointer);
 
Warning :
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

Pointer

public Pointer()
Default constructor.
No memory is owned, the object holded is null. The call isNull() will return true.

Method Detail

asString

public java.lang.String asString()
Retrieve the String value stored in a Pointer (null terminated string).

Returns:
the String stored in the Pointer.
null if no String is stored in the buffer.
See Also:
asString(int, int)

asString

public java.lang.String asString(int offset,
                                 int length)
Retrieve the String value stored in the Pointer.

Parameters:
offset - offset (in characters) from the current position in the Pointer.
length - length of the String to retrieve.
Returns:
the string stored in the Pointer.
See Also:
#asString(Pointer, BufferUtils.toString(ByteBuffer, int, int)

asByteBuffer

public java.nio.ByteBuffer asByteBuffer(int offsetInBytes,
                                        int capacityInBytes)
Create a view of the Pointer object as a ByteBuffer object.

Parameters:
offsetInBytes - offset in BYTES
capacityInBytes - capacity in BYTES
Returns:
the ByteBuffer view.

asInt

public int asInt()

asLong

public long asLong()

asFloat

public float asFloat()

asDouble

public double asDouble()

asPointer

public Pointer asPointer(long offset)

equals

public boolean equals(java.lang.Object object)
Use to know if two object are equals.
Do NOT use this :
 Sound sound1, sound2;
 ...
 if(sound1 == sound2)
 {
     ...
 
Use this :
 Sound sound1, sound2;
 ...
 if(sound1.equals(sound2))
 {
     ...
 


isNull

public boolean isNull()
Returns:
true if no memory is holded (ie object holded in the memory is null).

shareMemory

public void shareMemory(Pointer source)
Share the same memory region that the Pointer object passed as parameter.

Parameters:
source - a Pointer.


NativeFmodEx Project - © Copyright 2005-2010 - Jérôme Jouvie (Jouvieje)
NativeFmodEx is an Open Source Project under GNU LGPL License
My sites : http://jerome.jouvie.free.fr/

(Documentation Copyright © Firelight Technologies - FMOD Ex - http://www.fmod.org)