org.jouvieje.bass.misc
Class Pointer

java.lang.Object
  extended byorg.jouvieje.bass.misc.Pointer
Direct Known Subclasses:
Bass, BASS_3DVECTOR, BASS_CHANNELINFO, BASS_DEVICEINFO, BASS_DX8_CHORUS, BASS_DX8_COMPRESSOR, BASS_DX8_DISTORTION, BASS_DX8_ECHO, BASS_DX8_FLANGER, BASS_DX8_GARGLE, BASS_DX8_I3DL2REVERB, BASS_DX8_PARAMEQ, BASS_DX8_REVERB, BASS_FILEPROCS, BASS_INFO, BASS_PLUGINFORM, BASS_PLUGININFO, BASS_RECORDINFO, BASS_SAMPLE, HCHANNEL, HDSP, HFX, HMUSIC, HPLUGIN, HRECORD, HSAMPLE, HSTREAM, HSYNC, ObjectPointer, TAG_BEXT, TAG_ID3

public class Pointer
extends java.lang.Object

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 :

 Pointer pointer = ...;   //Object already created that store a String
 String string = PointerUtils.toString(pointer);
 
The object can also store an BASS object. For example a Sound :
 Pointer pointer = ...;   //Object already created that store a Sound
 Sound sound = Sound.createView(pointer);
 
Warning :
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

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()
This should only be used if you are sure that this object contains a String value.
This call :
   PointerUtils.toString(this)

Returns:
String holded by the object.
Return null if this.isNull() equals true.

asInt

public int asInt()

asLong

public long asLong()

asFloat

public float asFloat()

asDouble

public double asDouble()

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.


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)