@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.DeallocatorReference, Pointer.DeallocatorThread, Pointer.NativeDeallocator, Pointer.ProxyDeallocator, Pointer.ReferenceCounter| Modifier and Type | Field and Description |
|---|---|
private static Logger |
logger |
private P[] |
pointerArray
This is just to keep references to Pointer objects and prevent premature deallocation.
|
address, capacity, deallocatorThread, limit, maxBytes, maxPhysicalBytes, maxRetries, position| 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(String... array)
Allocates enough memory for the array of strings and copies it.
|
PointerPointer(String[] array,
Charset charset)
Allocates enough memory for the array of strings and copies it.
|
PointerPointer(String[] array,
String charsetName)
Allocates enough memory for the array of strings and copies it.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
allocateArray(long size) |
PointerPointer<P> |
capacity(long capacity)
Sets the capacity and returns this.
|
Pointer |
get() |
P |
get(Class<P> cls) |
P |
get(Class<P> cls,
long i) |
Pointer |
get(long i) |
PointerPointer<P> |
getPointer(long i)
Returns
getPointer(getClass(), i). |
String |
getString(long i) |
String |
getString(long i,
Charset charset) |
String |
getString(long i,
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(String... array)
|
PointerPointer<P> |
putString(String[] array,
Charset charset)
|
PointerPointer<P> |
putString(String[] array,
String charsetName)
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, init, interruptDeallocatorThread, isNull, isNull, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zeroprivate static final Logger logger
public PointerPointer(String... array)
array - the array of strings to copyputString(String[])public PointerPointer(String[] array, String charsetName) throws UnsupportedEncodingException
array - the array of strings to copycharsetName - the charset in which the bytes are encodedUnsupportedEncodingExceptionputString(String[], String)public PointerPointer(String[] array, 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()public PointerPointer(Pointer p)
Pointer(Pointer)private void allocateArray(long size)
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 PointerPointer<P> getPointer(long i)
PointergetPointer(getClass(), i).getPointer in class Pointerpublic String getString(long i)
get(BytePointer.class, i).getString()BytePointer.getString()public String getString(long i, String charsetName) throws UnsupportedEncodingException
get(BytePointer.class, i).getString(charsetName)UnsupportedEncodingExceptionBytePointer.getString(String)public String getString(long i, Charset charset)
get(BytePointer.class, i).getString(charset)BytePointer.getString(Charset)public PointerPointer<P> putString(String... array)
array - the array of String to read frompublic PointerPointer<P> putString(String[] array, String charsetName) throws UnsupportedEncodingException
array - the array of String to read fromcharsetName - the charset in which the bytes are encodedUnsupportedEncodingExceptionpublic PointerPointer<P> putString(String[] array, 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(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 copyCopyright © 2025. All rights reserved.