|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--CPointer
An abstraction for a C pointer data type. A CPointer 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.
CFunction
Field Summary | |
protected long |
peer
|
static int |
SIZE
The size of a C pointer on the platform this Java virtual machine is running on. |
Constructor Summary | |
CPointer()
|
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 CPointer to the specified object. |
byte |
getByte(int offset)
Indirect the C pointer as a pointer to byte . |
CPointer |
getCPointer(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 |
setCPointer(int offset,
CPointer 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 |
clone,
finalize,
getClass,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int SIZE
protected long peer
Constructor Detail |
public CPointer()
Method Detail |
public boolean equals(java.lang.Object other)
CPointer
to the specified object.other
- a CPointer
CPointer
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.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 indirectionbyte
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 indirectionshort
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 indirectionint
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 indirectionlong
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 indirectionfloat
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 indirectiondouble
value being pointed topublic CPointer getCPointer(int offset)
*((void **)((char *)cptr + offset))
.offset
- byte offset from pointer to perform the indirectionpointer
value being pointed topublic java.lang.String getString(int offset)
char *
, a
NULL
-terminated C string. Convert the C string to a
java.lang.String
.offset
- byte offset from pointer to obtain the C stringString
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 setCPointer(int offset, CPointer 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
- CPointer
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
- java.lang.String
value to set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |