@Name(value="long") @Properties(inherit=javacpp.class) public class CLongPointer extends Pointer
long
.
All operations take into account the position and limit, when appropriate.
We need this class because platforms supported by Java do not all agree on the
size of the native C++ long
type, unlike int
and short
.
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 |
---|
CLongPointer() |
CLongPointer(long... array)
Allocates enough memory for the array and copies it.
|
CLongPointer(long size)
Allocates a native
long array of the given size. |
CLongPointer(Pointer p) |
Modifier and Type | Method and Description |
---|---|
private void |
allocateArray(long size) |
CLongPointer |
capacity(long capacity)
Sets the capacity and returns this.
|
long |
get() |
long |
get(long i) |
CLongPointer |
get(long[] array) |
CLongPointer |
get(long[] array,
int offset,
int length)
Reads a portion of the native array into a Java array.
|
CLongPointer |
limit(long limit)
Sets the limit and returns this.
|
CLongPointer |
position(long position)
Sets the position and returns this.
|
CLongPointer |
put(long... array) |
CLongPointer |
put(long l) |
CLongPointer |
put(long[] array,
int offset,
int length)
Writes a portion of a Java array into the native array.
|
CLongPointer |
put(long i,
long l)
Copies the
long value to the i-th element of a native array. |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, init, isNull, isNull, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zero
private static final Logger logger
public CLongPointer(long... array)
array
- the array to copyput(long[])
public CLongPointer(long size)
long
array of the given size.size
- the number of long
elements to allocatepublic CLongPointer()
Pointer.Pointer()
public CLongPointer(Pointer p)
Pointer.Pointer(Pointer)
private void allocateArray(long size)
public CLongPointer position(long position)
Pointer
array.position(i)
statement sort of equivalent to the array[i]
statement in C++.position
in class Pointer
position
- the new positionPointer.position(long)
public CLongPointer limit(long limit)
Pointer
limit
in class Pointer
limit
- the new limitPointer.limit(long)
public CLongPointer capacity(long capacity)
Pointer
capacity
in class Pointer
capacity
- the new capacityPointer.capacity(long)
public long get()
get(0)
public CLongPointer put(long l)
put(0, l)
public CLongPointer put(long i, long l)
long
value to the i-th element of a native array.i
- the index into the arrayl
- the long
value to copypublic CLongPointer get(long[] array)
get(array, 0, array.length)
public CLongPointer put(long... array)
put(array, 0, array.length)
public CLongPointer get(long[] 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 CLongPointer put(long[] 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 writeCopyright © 2020. All rights reserved.