@Properties(inherit=javacpp.class) public class IntPointer extends Pointer
int, also used for UTF-32.
All operations take into account the position and limit, when appropriate.Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.DeallocatorReference, Pointer.DeallocatorThread, Pointer.NativeDeallocator, Pointer.ProxyDeallocator, Pointer.ReferenceCounter| Modifier and Type | Field and Description |
|---|---|
private static Logger |
logger |
address, capacity, deallocatorThread, limit, maxBytes, maxPhysicalBytes, maxRetries, position| Constructor and Description |
|---|
IntPointer() |
IntPointer(int... array)
Allocates enough memory for the array and copies it.
|
IntPointer(IntBuffer buffer)
For direct buffers, calls
Pointer(Buffer), while for buffers
backed with an array, allocates enough memory for the array and copies it. |
IntPointer(long size)
Allocates a native
int array of the given size. |
IntPointer(Pointer p) |
IntPointer(String s)
Allocates enough memory for encoding the String in UTF-32 and copies it.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
allocateArray(long size) |
IntBuffer |
asBuffer()
Same as
Pointer.asByteBuffer(), but can be overridden to return subclasses of Buffer. |
IntPointer |
capacity(long capacity)
Sets the capacity and returns this.
|
int |
get() |
IntPointer |
get(int[] array) |
IntPointer |
get(int[] array,
int offset,
int length)
Reads a portion of the native array into a Java array.
|
int |
get(long i) |
IntPointer |
getPointer(long i)
Returns
getPointer(getClass(), i). |
String |
getString()
Returns the String, assuming a null-terminated string if
limit <= position. |
int[] |
getStringCodePoints()
Returns the code points, assuming a null-terminated string if
limit <= position. |
IntPointer |
limit(long limit)
Sets the limit and returns this.
|
IntPointer |
position(long position)
Sets the position and returns this.
|
IntPointer |
put(int... array) |
IntPointer |
put(int j) |
IntPointer |
put(int[] array,
int offset,
int length)
Writes a portion of a Java array into the native array.
|
IntPointer |
put(long i,
int j)
Copies the
int value to the i-th element of a native array. |
IntPointer |
putString(String s)
Copies the String code points into native memory, including a terminating null int.
|
int |
sizeof()
Returns 1 for Pointer or BytePointer else
Loader.sizeof(getClass()) or -1 on error. |
address, 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, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zeroprivate static final Logger logger
public IntPointer(String s)
s - the String to copyputString(String)public IntPointer(int... array)
array - the array to copyput(int[])public IntPointer(IntBuffer buffer)
Pointer(Buffer), while for buffers
backed with an array, allocates enough memory for the array and copies it.buffer - the Buffer to reference or copyput(int[])public IntPointer(long size)
int array of the given size.size - the number of int elements to allocatepublic IntPointer()
Pointer()public IntPointer(Pointer p)
Pointer(Pointer)private void allocateArray(long size)
public IntPointer 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 IntPointer limit(long limit)
Pointerlimit in class Pointerlimit - the new limitPointer.limit(long)public IntPointer capacity(long capacity)
Pointercapacity in class Pointercapacity - the new capacityPointer.capacity(long)public int sizeof()
PointerLoader.sizeof(getClass()) or -1 on error.public IntPointer getPointer(long i)
PointergetPointer(getClass(), i).getPointer in class Pointerpublic int[] getStringCodePoints()
limit <= position.public String getString()
limit <= position.public IntPointer putString(String s)
s - the String to copyString.codePointAt(int),
put(int[])public int get()
get(0)public int get(long i)
int value of a native arraypublic IntPointer put(int j)
put(0, j)public IntPointer put(long i, int j)
int value to the i-th element of a native array.i - the index into the arrayj - the int value to copypublic IntPointer get(int[] array)
get(array, 0, array.length)public IntPointer put(int... array)
put(array, 0, array.length)public IntPointer get(int[] array, int offset, int length)
array - the array to write tooffset - the offset into the array where to start writinglength - the length of data to read and writepublic IntPointer put(int[] array, int offset, int length)
array - the array to read fromoffset - the offset into the array where to start readinglength - the length of data to read and writepublic final IntBuffer asBuffer()
PointerPointer.asByteBuffer(), but can be overridden to return subclasses of Buffer.asBuffer in class PointerasByteBuffer().asIntBuffer()BytePointer.asBuffer(),
ShortPointer.asBuffer(),
asBuffer(),
LongPointer.asBuffer(),
FloatPointer.asBuffer(),
DoublePointer.asBuffer(),
CharPointer.asBuffer()Copyright © 2025. All rights reserved.