public abstract class NativeObject extends java.lang.Object implements INativeObject
INativeType
.
Supported data types are
Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG
DEBUG flag
|
protected INativeHandle |
handle
The handle to the memory chunk used by this object.
|
static int |
SHIFT_INT |
static int |
SHIFT_LONG |
static int |
SHIFT_LONGLONG |
static int |
SIZE_BYTE |
static int |
SIZE_INT |
static int |
SIZE_LONG |
static int |
SIZE_LONGLONG |
static int |
SIZE_PTR |
static int |
SIZE_SHORT |
Modifier | Constructor and Description |
---|---|
protected |
NativeObject() |
protected |
NativeObject(INativeHandle handle)
Create a new NativeObject in C-Memory at pointer "handle".
|
Modifier and Type | Method and Description |
---|---|
protected void |
allocate()
Manage the objects memory in Java.
|
INativeObject |
cast(INativeType declaration)
This is a special form of the "createNative" signature, implementing a
"type cast" on the same memory location.
|
INativeObject |
createReference() |
byte |
getByte(int index)
The byte at index as a native byte.
|
byte[] |
getByteArray(int index,
int count)
The element at index as an array of native byte with dimension count.
|
abstract int |
getByteCount()
The number of bytes occupied by this.
|
byte[] |
getBytes()
The bytes copied from C-memory that represent this.
|
long |
getCLong(int index)
The element at index as a native long.
|
int |
getInt(int index)
The element at index as a native int.
|
INativeHandle |
getNativeHandle()
The C-Pointer where the associated memory is found.
|
INativeHandle |
getNativeHandle(int index) |
abstract INativeType |
getNativeType()
The meta information and behavior for the NativeObject.
|
short |
getShort(int index)
The element at index as a native short.
|
java.lang.String |
getString(int index) |
java.lang.String |
getWideString(int index) |
boolean |
isNull()
Answer
true if this is "null". |
void |
setByte(int index,
byte value) |
void |
setByteArray(int index,
byte[] value,
int valueOffset,
int valueCount) |
void |
setCLong(int index,
long value) |
void |
setInt(int index,
int value) |
void |
setNativeHandle(int index,
INativeHandle value) |
void |
setShort(int index,
short value) |
void |
setString(int index,
java.lang.String value) |
void |
setWideString(int index,
java.lang.String value) |
java.lang.String |
toNestedString()
A string for debugging purposes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getValue, setValue
public static final int SIZE_BYTE
public static final int SIZE_INT
public static final int SHIFT_INT
public static final int SIZE_LONGLONG
public static final int SHIFT_LONGLONG
public static final int SIZE_LONG
public static final int SHIFT_LONG
public static final int SIZE_PTR
public static final int SIZE_SHORT
public static boolean DEBUG
protected INativeHandle handle
The handle should only be assigned in the constructor, via parameter or "allocate".
protected NativeObject()
protected NativeObject(INativeHandle handle)
handle
- The pointer in C-memoryprotected void allocate()
public INativeObject cast(INativeType declaration)
declaration
- The new base declaration type.INativeObject
at the same memory location as this,
but of a different type.public INativeObject createReference()
public byte getByte(int index)
index
- The index of the element to be reported.public byte[] getByteArray(int index, int count)
index
- The index of the element to be reported.public abstract int getByteCount()
public byte[] getBytes()
getBytes
in interface INativeObject
public long getCLong(int index)
index
- The index of the element to be reported.public int getInt(int index)
index
- The index of the element to be reported.public INativeHandle getNativeHandle()
getNativeHandle
in interface INativeObject
public INativeHandle getNativeHandle(int index)
public abstract INativeType getNativeType()
There is exactly one meta instance for all NativeObject instances of a certain type.
getNativeType
in interface INativeObject
public short getShort(int index)
index
- The index of the element to be reported.public java.lang.String getString(int index)
public java.lang.String getWideString(int index)
public boolean isNull()
true
if this is "null". This means the associated
C-pointer is pointing to 0.true
if this is "null".public void setByte(int index, byte value)
public void setByteArray(int index, byte[] value, int valueOffset, int valueCount)
public void setCLong(int index, long value)
public void setInt(int index, int value)
public void setNativeHandle(int index, INativeHandle value)
public void setShort(int index, short value)
public void setString(int index, java.lang.String value)
public void setWideString(int index, java.lang.String value)
public java.lang.String toNestedString()