@Properties(inherit=javacpp.class) public class PointerPointer<P extends Pointer> extends Pointer
void*.
All operations take into account the position and limit, when appropriate.
To support higher levels of indirection, we can create out of the Pointer
objects returned by get(long) additional PointerPointer objects.
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter| Constructor and Description |
|---|
PointerPointer() |
PointerPointer(byte[]... array)
Allocates enough memory for the array of arrays and copies it.
|
PointerPointer(char[]... array)
Allocates enough memory for the array of arrays and copies it.
|
PointerPointer(double[]... array)
Allocates enough memory for the array of arrays and copies it.
|
PointerPointer(float[]... array)
Allocates enough memory for the array of arrays and copies it.
|
PointerPointer(int[]... array)
Allocates enough memory for the array of arrays and copies it.
|
PointerPointer(long size)
Allocates a native array of
void* of the given size. |
PointerPointer(long[]... array)
Allocates enough memory for the array of arrays and copies it.
|
PointerPointer(P... array)
Allocates enough memory for the array and copies it.
|
PointerPointer(Pointer p) |
PointerPointer(short[]... array)
Allocates enough memory for the array of arrays and copies it.
|
PointerPointer(java.lang.String... array)
Allocates enough memory for the array of strings and copies it.
|
PointerPointer(java.lang.String[] array,
java.nio.charset.Charset charset)
Allocates enough memory for the array of strings and copies it.
|
PointerPointer(java.lang.String[] array,
java.lang.String charsetName)
Allocates enough memory for the array of strings and copies it.
|
| Modifier and Type | Method and Description |
|---|---|
PointerPointer<P> |
capacity(long capacity)
Sets the capacity and returns this.
|
Pointer |
get() |
P |
get(java.lang.Class<P> cls) |
P |
get(java.lang.Class<P> cls,
long i) |
Pointer |
get(long i) |
java.lang.String |
getString(long i) |
java.lang.String |
getString(long i,
java.nio.charset.Charset charset) |
java.lang.String |
getString(long i,
java.lang.String charsetName) |
PointerPointer<P> |
limit(long limit)
Sets the limit and returns this.
|
PointerPointer<P> |
position(long position)
Sets the position and returns this.
|
PointerPointer<P> |
put(byte[]... array)
|
PointerPointer<P> |
put(char[]... array)
|
PointerPointer<P> |
put(double[]... array)
Creates one by one a new
DoublePointer for each double[],
and writes them into the native void* array. |
PointerPointer<P> |
put(float[]... array)
Creates one by one a new
FloatPointer for each float[],
and writes them into the native void* array. |
PointerPointer<P> |
put(int[]... array)
|
PointerPointer<P> |
put(long[]... array)
|
PointerPointer<P> |
put(long i,
Pointer p)
Copies the Pointer value to the i-th element of a native array.
|
PointerPointer<P> |
put(P... array)
Writes the Pointer values into the native
void* array. |
PointerPointer<P> |
put(Pointer p)
Calls in effect
memcpy(this.address + this.position, p.address + p.position, length),
where length = sizeof(p) * (p.limit - p.position). |
PointerPointer<P> |
put(short[]... array)
Creates one by one a new
ShortPointer for each short[],
and writes them into the native void* array. |
PointerPointer<P> |
putString(java.lang.String... array)
|
PointerPointer<P> |
putString(java.lang.String[] array,
java.nio.charset.Charset charset)
|
PointerPointer<P> |
putString(java.lang.String[] array,
java.lang.String charsetName)
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zeropublic PointerPointer(java.lang.String... array)
array - the array of strings to copyputString(String[])public PointerPointer(java.lang.String[] array,
java.lang.String charsetName)
throws java.io.UnsupportedEncodingException
array - the array of strings to copycharsetName - the charset in which the bytes are encodedjava.io.UnsupportedEncodingExceptionputString(String[], String)public PointerPointer(java.lang.String[] array,
java.nio.charset.Charset charset)
array - the array of strings to copycharset - the charset in which the bytes are encodedputString(String[], String)public PointerPointer(P... array)
array - the array to copyput(Pointer[])public PointerPointer(byte[]... array)
array - the array of arrays to copyput(byte[][])public PointerPointer(short[]... array)
array - the array of arrays to copyput(short[][])public PointerPointer(int[]... array)
array - the array of arrays to copyput(int[][])public PointerPointer(long[]... array)
array - the array of arrays to copyput(long[][])public PointerPointer(float[]... array)
array - the array of arrays to copyput(float[][])public PointerPointer(double[]... array)
array - the array of arrays to copyput(double[][])public PointerPointer(char[]... array)
array - the array of arrays to copyput(char[][])public PointerPointer(long size)
void* of the given size.size - the number of void* elements to allocatepublic PointerPointer()
Pointer.Pointer()public PointerPointer(Pointer p)
Pointer.Pointer(Pointer)public PointerPointer<P> position(long position)
Pointerarray.position(i)
statement sort of equivalent to the array[i] statement in C++.position in class Pointerposition - the new positionPointer.position(long)public PointerPointer<P> limit(long limit)
Pointerlimit in class Pointerlimit - the new limitPointer.limit(long)public PointerPointer<P> capacity(long capacity)
Pointercapacity in class Pointercapacity - the new capacityPointer.capacity(long)public java.lang.String getString(long i)
get(BytePointer.class, i).getString()BytePointer.getString()public java.lang.String getString(long i,
java.lang.String charsetName)
throws java.io.UnsupportedEncodingException
get(BytePointer.class, i).getString(charsetName)java.io.UnsupportedEncodingExceptionBytePointer.getString(String)public java.lang.String getString(long i,
java.nio.charset.Charset charset)
get(BytePointer.class, i).getString(charset)BytePointer.getString(Charset)public PointerPointer<P> putString(java.lang.String... array)
array - the array of String to read frompublic PointerPointer<P> putString(java.lang.String[] array, java.lang.String charsetName) throws java.io.UnsupportedEncodingException
array - the array of String to read fromcharsetName - the charset in which the bytes are encodedjava.io.UnsupportedEncodingExceptionpublic PointerPointer<P> putString(java.lang.String[] array, java.nio.charset.Charset charset)
array - the array of String to read fromcharset - the charset in which the bytes are encodedpublic PointerPointer<P> put(P... array)
void* array.array - the array of Pointer values to read frompublic PointerPointer<P> put(byte[]... array)
array - the array of byte[] to read frompublic PointerPointer<P> put(short[]... array)
ShortPointer for each short[],
and writes them into the native void* array.array - the array of short[] to read frompublic PointerPointer<P> put(int[]... array)
array - the array of int[] to read frompublic PointerPointer<P> put(long[]... array)
array - the array of long[] to read frompublic PointerPointer<P> put(float[]... array)
FloatPointer for each float[],
and writes them into the native void* array.array - the array of float[] to read frompublic PointerPointer<P> put(double[]... array)
DoublePointer for each double[],
and writes them into the native void* array.array - the array of double[] to read frompublic PointerPointer<P> put(char[]... array)
array - the array of char[] to read frompublic Pointer get()
get(0)public Pointer get(long i)
public P get(java.lang.Class<P> cls, long i)
public PointerPointer<P> put(Pointer p)
Pointermemcpy(this.address + this.position, p.address + p.position, length),
where length = sizeof(p) * (p.limit - p.position).
If limit == 0, it uses position + 1 instead. The way the methods were designed
allows constructs such as this.position(0).put(p.position(13).limit(42)).public PointerPointer<P> put(long i, Pointer p)
i - the index into the arrayp - the Pointer value to copy