@Properties(inherit=javacpp.class) public class ShortPointer extends Pointer
short
.
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 |
---|
ShortPointer() |
ShortPointer(long size)
Allocates a native
short array of the given size. |
ShortPointer(Pointer p) |
ShortPointer(short... array)
Allocates enough memory for the array and copies it.
|
ShortPointer(ShortBuffer buffer)
For direct buffers, calls
Pointer.Pointer(Buffer) , while for buffers
backed with an array, allocates enough memory for the array and copies it. |
Modifier and Type | Method and Description |
---|---|
private void |
allocateArray(long size) |
ShortBuffer |
asBuffer()
Same as
Pointer.asByteBuffer() , but can be overridden to return subclasses of Buffer. |
ShortPointer |
capacity(long capacity)
Sets the capacity and returns this.
|
short |
get() |
short |
get(long i) |
ShortPointer |
get(short[] array) |
ShortPointer |
get(short[] array,
int offset,
int length)
Reads a portion of the native array into a Java array.
|
ShortPointer |
limit(long limit)
Sets the limit and returns this.
|
ShortPointer |
position(long position)
Sets the position and returns this.
|
ShortPointer |
put(long i,
short s)
Copies the
short value to the i-th element of a native array. |
ShortPointer |
put(short... array) |
ShortPointer |
put(short s) |
ShortPointer |
put(short[] array,
int offset,
int length)
Writes a portion of a Java array into the native array.
|
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, hashCode, init, isNull, isNull, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, toString, totalBytes, totalPhysicalBytes, withDeallocator, zero
private static final Logger logger
public ShortPointer(short... array)
array
- the array to copyput(short[])
public ShortPointer(ShortBuffer buffer)
Pointer.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(short[])
public ShortPointer(long size)
short
array of the given size.size
- the number of short
elements to allocatepublic ShortPointer()
Pointer.Pointer()
public ShortPointer(Pointer p)
Pointer.Pointer(Pointer)
private void allocateArray(long size)
public ShortPointer 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 ShortPointer limit(long limit)
Pointer
limit
in class Pointer
limit
- the new limitPointer.limit(long)
public ShortPointer capacity(long capacity)
Pointer
capacity
in class Pointer
capacity
- the new capacityPointer.capacity(long)
public int sizeof()
Pointer
Loader.sizeof(getClass())
or -1 on error.public short get()
get(0)
public short get(long i)
short
value of a native arraypublic ShortPointer put(short s)
put(0, s)
public ShortPointer put(long i, short s)
short
value to the i-th element of a native array.i
- the index into the arrays
- the short
value to copypublic ShortPointer get(short[] array)
get(array, 0, array.length)
public ShortPointer put(short... array)
put(array, 0, array.length)
public ShortPointer get(short[] 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 ShortPointer put(short[] 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 ShortBuffer asBuffer()
Pointer
Pointer.asByteBuffer()
, but can be overridden to return subclasses of Buffer.asBuffer
in class Pointer
asByteBuffer().asShortBuffer()
BytePointer.asBuffer()
,
asBuffer()
,
IntPointer.asBuffer()
,
LongPointer.asBuffer()
,
FloatPointer.asBuffer()
,
DoublePointer.asBuffer()
,
CharPointer.asBuffer()
Copyright © 2020. All rights reserved.