public class DoublePointer extends Pointer
double
.
All operations take into account the position and limit, when appropriate.Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator
Constructor and Description |
---|
DoublePointer() |
DoublePointer(double... array)
Allocates enough memory for the array and copies it.
|
DoublePointer(DoubleBuffer buffer)
For direct buffers, calls
Pointer.Pointer(Buffer) , while for buffers
backed with an array, allocates enough memory for the array and copies it. |
DoublePointer(int size)
Allocates a native
double array of the given size. |
DoublePointer(Pointer p) |
Modifier and Type | Method and Description |
---|---|
private void |
allocateArray(int size) |
DoubleBuffer |
asBuffer()
Same as
Pointer.asByteBuffer() , but can be overridden to return subclasses of Buffer. |
DoublePointer |
capacity(int capacity)
Sets the capacity and returns this.
|
double |
get() |
DoublePointer |
get(double[] array) |
DoublePointer |
get(double[] array,
int offset,
int length)
Reads a portion of the native array into a Java array.
|
double |
get(int i) |
DoublePointer |
limit(int limit)
Sets the limit and returns this.
|
DoublePointer |
position(int position)
Sets the position and returns this.
|
DoublePointer |
put(double... array) |
DoublePointer |
put(double d) |
DoublePointer |
put(double[] array,
int offset,
int length)
Writes a portion of a Java array into the native array.
|
DoublePointer |
put(int i,
double d)
Copies the
double value to the i-th element of a native array. |
address, asByteBuffer, capacity, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, hashCode, init, isNull, limit, memchr, memcmp, memcpy, memmove, memset, offsetof, position, put, setNull, sizeof, toString, withDeallocator, zero
public DoublePointer(double... array)
array
- the array to copyput(double[])
public DoublePointer(DoubleBuffer 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(double[])
public DoublePointer(int size)
double
array of the given size.size
- the number of double
elements to allocatepublic DoublePointer()
Pointer.Pointer()
public DoublePointer(Pointer p)
Pointer.Pointer(Pointer)
private void allocateArray(int size)
public DoublePointer position(int 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(int)
public DoublePointer limit(int limit)
Pointer
limit
in class Pointer
limit
- the new limitPointer.limit(int)
public DoublePointer capacity(int capacity)
Pointer
capacity
in class Pointer
capacity
- the new capacityPointer.capacity(int)
public double get()
get(0)
public double get(int i)
double
value of a native arraypublic DoublePointer put(double d)
put(0, d)
public DoublePointer put(int i, double d)
double
value to the i-th element of a native array.i
- the index into the arrayd
- the double
value to copypublic DoublePointer get(double[] array)
get(array, 0, array.length)
public DoublePointer put(double... array)
put(array, 0, array.length)
public DoublePointer get(double[] 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 DoublePointer put(double[] 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 DoubleBuffer asBuffer()
Pointer
Pointer.asByteBuffer()
, but can be overridden to return subclasses of Buffer.asBuffer
in class Pointer
asByteBuffer().asDoubleBuffer()
BytePointer.asBuffer()
,
ShortPointer.asBuffer()
,
IntPointer.asBuffer()
,
LongPointer.asBuffer()
,
FloatPointer.asBuffer()
,
asBuffer()
,
CharPointer.asBuffer()
Copyright © 2015. All Rights Reserved.