|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jstatcom.engine.CPtr
public class CPtr
An abstraction for a C pointer data type. A CPtr instance represents, on the
Java side, a C pointer. The C pointer could be any type of C
pointer. Methods such as copyIn
,copyOut
,
getXXX
, and setXXX
, provide means to indirect
the underlying C pointer.
CFunc
Field Summary | |
---|---|
static CPtr |
NULL
A canonical representation of C's NULL pointer. |
static int |
SIZE
The size of a C pointer on the platform this Java virtual machine is running on. |
Method Summary | |
---|---|
void |
copyIn(int bOff,
byte[] buf,
int index,
int length)
Indirect the C pointer, copying into memory pointed to by C pointer, from the specified array. |
void |
copyIn(int bOff,
char[] buf,
int index,
int length)
Indirect the C pointer, copying into memory pointed to by C pointer, from the specified array. |
void |
copyIn(int bOff,
double[] buf,
int index,
int length)
Indirect the C pointer, copying into memory pointed to by C pointer, from the specified array. |
void |
copyIn(int bOff,
float[] buf,
int index,
int length)
Indirect the C pointer, copying into memory pointed to by C pointer, from the specified array. |
void |
copyIn(int bOff,
int[] buf,
int index,
int length)
Indirect the C pointer, copying into memory pointed to by C pointer, from the specified array. |
void |
copyIn(int bOff,
long[] buf,
int index,
int length)
Indirect the C pointer, copying into memory pointed to by C pointer, from the specified array. |
void |
copyIn(int bOff,
short[] buf,
int index,
int length)
Indirect the C pointer, copying into memory pointed to by C pointer, from the specified array. |
void |
copyOut(int bOff,
byte[] buf,
int index,
int length)
Indirect the C pointer, copying from memory pointed to by C pointer, into the specified array. |
void |
copyOut(int bOff,
char[] buf,
int index,
int length)
Indirect the C pointer, copying from memory pointed to by C pointer, into the specified array. |
void |
copyOut(int bOff,
double[] buf,
int index,
int length)
Indirect the C pointer, copying from memory pointed to by C pointer, into the specified array. |
void |
copyOut(int bOff,
float[] buf,
int index,
int length)
Indirect the C pointer, copying from memory pointed to by C pointer, into the specified array. |
void |
copyOut(int bOff,
int[] buf,
int index,
int length)
Indirect the C pointer, copying from memory pointed to by C pointer, into the specified array. |
void |
copyOut(int bOff,
long[] buf,
int index,
int length)
Indirect the C pointer, copying from memory pointed to by C pointer, into the specified array. |
void |
copyOut(int bOff,
short[] buf,
int index,
int length)
Indirect the C pointer, copying from memory pointed to by C pointer, into the specified array. |
boolean |
equals(java.lang.Object other)
Compares this CPtr to the specified object. |
byte |
getByte(int offset)
Indirect the C pointer as a pointer to byte . |
CPtr |
getCPtr(int offset)
Indirect the C pointer as a pointer to pointer. |
double |
getDouble(int offset)
Indirect the C pointer as a pointer to double . |
float |
getFloat(int offset)
Indirect the C pointer as a pointer to float . |
int |
getInt(int offset)
Indirect the C pointer as a pointer to int . |
long |
getLong(int offset)
Indirect the C pointer as a pointer to long . |
short |
getShort(int offset)
Indirect the C pointer as a pointer to short . |
java.lang.String |
getString(int offset)
Indirect the C pointer as a pointer to char * , a
NULL -terminated C string. |
int |
hashCode()
Returns a hashcode for the C pointer represented by this Cptr object. |
void |
setByte(int offset,
byte value)
Set value at location being pointed to. |
void |
setCPtr(int offset,
CPtr value)
Set value at location being pointed to. |
void |
setDouble(int offset,
double value)
Set value at location being pointed to. |
void |
setFloat(int offset,
float value)
Set value at location being pointed to. |
void |
setInt(int offset,
int value)
Set value at location being pointed to. |
void |
setLong(int offset,
long value)
Set value at location being pointed to. |
void |
setShort(int offset,
short value)
Set value at location being pointed to. |
void |
setString(int offset,
java.lang.String value)
Copy string value to the location being pointed to. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SIZE
public static final CPtr NULL
Method Detail |
---|
public boolean equals(java.lang.Object other)
CPtr
to the specified object.
equals
in class java.lang.Object
other
- a CPtr
CPtr
object and the
class of other
are exactly equal, and the C
pointers being pointed to by these objects are also equal.
Returns false otherwise.public int hashCode()
Cptr
object.
hashCode
in class java.lang.Object
public void copyIn(int bOff, byte[] buf, int index, int length)
bOff
- byte offset from pointer into which data is copiedbuf
- byte
array from which to copyindex
- array index from which to start copyinglength
- number of elements from buf
that must be copiedpublic void copyIn(int bOff, short[] buf, int index, int length)
bOff
- byte offset from pointer into which data is copiedbuf
- short
array from which to copyindex
- array index from which to start copyinglength
- number of elements from buf
that must be copiedpublic void copyIn(int bOff, char[] buf, int index, int length)
bOff
- byte offset from pointer into which data is copiedbuf
- char
array from which to copyindex
- array index from which to start copyinglength
- number of elements from buf
that must be copiedpublic void copyIn(int bOff, int[] buf, int index, int length)
bOff
- byte offset from pointer into which data is copiedbuf
- int
array from which to copyindex
- array index from which to start copyinglength
- number of elements from buf
that must be copiedpublic void copyIn(int bOff, long[] buf, int index, int length)
bOff
- byte offset from pointer into which data is copiedbuf
- long
array from which to copyindex
- array index from which to start copyinglength
- number of elements from buf
that must be copiedpublic void copyIn(int bOff, float[] buf, int index, int length)
bOff
- byte offset from pointer into which data is copiedbuf
- float
array from which to copyindex
- array index from which to start copyinglength
- number of elements from buf
that must be copiedpublic void copyIn(int bOff, double[] buf, int index, int length)
bOff
- byte offset from pointer into which data is copiedbuf
- double
array from which to copyindex
- array index from which to start copyinglength
- number of elements from buf
that must be copiedpublic void copyOut(int bOff, byte[] buf, int index, int length)
bOff
- byte offset from pointer into which data is copiedbuf
- byte
array into which data is copiedindex
- array index from which to start copyinglength
- number of elements from C pointer that must be copiedpublic void copyOut(int bOff, short[] buf, int index, int length)
bOff
- byte offset from pointer from which data is copiedbuf
- short
array into which data is copiedindex
- array index to which data is copiedlength
- number of elements from C pointer that must be copiedpublic void copyOut(int bOff, char[] buf, int index, int length)
bOff
- byte offset from pointer from which data is copiedbuf
- char
array into which data is copiedindex
- array index to which data is copiedlength
- number of elements from C pointer that must be copiedpublic void copyOut(int bOff, int[] buf, int index, int length)
bOff
- byte offset from pointer from which data is copiedbuf
- int
array into which data is copiedindex
- array index to which data is copiedlength
- number of elements from C pointer that must be copiedpublic void copyOut(int bOff, long[] buf, int index, int length)
bOff
- byte offset from pointer from which data is copiedbuf
- long
array into which data is copiedindex
- array index to which data is copiedlength
- number of elements from C pointer that must be copiedpublic void copyOut(int bOff, float[] buf, int index, int length)
bOff
- byte offset from pointer from which data is copiedbuf
- float
array into which data is copiedindex
- array index to which data is copiedlength
- number of elements from C pointer that must be copiedpublic void copyOut(int bOff, double[] buf, int index, int length)
bOff
- byte offset from pointer from which data is copiedbuf
- double
array into which data is copiedindex
- array index to which data is copiedlength
- number of elements from C pointer that must be copiedpublic byte getByte(int offset)
byte
. This is
equivalent to the expression
*((jbyte *)((char *)cptr + * offset))
.
offset
- offset from pointer to perform the indirection
byte
value being pointed topublic short getShort(int offset)
short
. This is
equivalent to the expression
*((jshort *)((char *)cptr + offset))
.
offset
- byte offset from pointer to perform the indirection
short
value being pointed topublic int getInt(int offset)
int
. This is
equivalent to the expression
*((jint *)((char *)cptr + offset))
.
offset
- byte offset from pointer to perform the indirection
int
value being pointed topublic long getLong(int offset)
long
. This is
equivalent to the expression
*((jlong *)((char *)cptr + offset))
.
offset
- byte offset from pointer to perform the indirection
long
value being pointed topublic float getFloat(int offset)
float
. This is
equivalent to the expression
*((jfloat *)((char *)cptr + offset))
.
offset
- byte offset from pointer to perform the indirection
float
value being pointed topublic double getDouble(int offset)
double
. This is
equivalent to the expression
*((jdouble *)((char *)cptr + offset))
.
offset
- byte offset from pointer to perform the indirection
double
value being pointed topublic CPtr getCPtr(int offset)
*((void **)((char *)cptr + offset))
.
offset
- byte offset from pointer to perform the indirection
pointer
value being pointed topublic java.lang.String getString(int offset)
char *
, a
NULL
-terminated C string. Convert the C string to a
String
.
offset
- byte offset from pointer to obtain the C string
String
value being pointed topublic void setByte(int offset, byte value)
value
at location being pointed to. This is equivalent
to the expression
*((jbyte *)((char *)cptr + offset)) = value
.
offset
- byte offset from pointer at which value
must be
setvalue
- byte
value to setpublic void setShort(int offset, short value)
value
at location being pointed to. This is equivalent
to the expression
*((jshort *)((char *)cptr + offset)) = value
.
offset
- byte offset from pointer at which value
must be
setvalue
- short
value to setpublic void setInt(int offset, int value)
value
at location being pointed to. This is equivalent
to the expression *((jint *)((char *)cptr + offset)) = value
.
offset
- byte offset from pointer at which value
must be
setvalue
- int
value to setpublic void setLong(int offset, long value)
value
at location being pointed to. This is equivalent
to the expression
*((jlong *)((char *)cptr + offset)) = value
.
offset
- byte offset from pointer at which value
must be
setvalue
- long
value to setpublic void setFloat(int offset, float value)
value
at location being pointed to. This is equivalent
to the expression
*((jfloat *)((char *)cptr + offset)) = value
.
offset
- byte offset from pointer at which value
must be
setvalue
- float
value to setpublic void setDouble(int offset, double value)
value
at location being pointed to. This is equivalent
to the expression
*((jdouble *)((char *)cptr + offset)) = value
.
offset
- byte offset from pointer at which value
must be
setvalue
- double
value to setpublic void setCPtr(int offset, CPtr value)
value
at location being pointed to. This is equivalent
to the expression *((void **)((char *)cptr + offset)) = value.
offset
- byte offset from pointer at which value
must be
setvalue
- CPtr
value to setpublic void setString(int offset, java.lang.String value)
value
to the location being pointed to. Copy
each element in value
, converted to native encoding, at
an offset
from the location pointed to by this pointer.
offset
- byte offset from pointer at which characters in
value
must be setvalue
- String
value to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |