public abstract class Pointer<T> extends Object implements Comparable<Pointer<?>>, Iterable<T>
Manipulating memory
pointerToAddress(long)
getInt()
/ setInt(int)
getLong()
/ setLong(long)
getShort()
/ setShort(short)
getByte()
/ setByte(byte)
getChar()
/ setChar(char)
getFloat()
/ setFloat(float)
getDouble()
/ setDouble(double)
getBoolean()
/ setBoolean(boolean)
getSizeT()
/ setSizeT(long)
getCLong()
/ setCLong(long)
getIntAtIndex(long)
/ setIntAtIndex(long, int)
getLongAtIndex(long)
/ setLongAtIndex(long, long)
getShortAtIndex(long)
/ setShortAtIndex(long, short)
getByteAtIndex(long)
/ setByteAtIndex(long, byte)
getCharAtIndex(long)
/ setCharAtIndex(long, char)
getFloatAtIndex(long)
/ setFloatAtIndex(long, float)
getDoubleAtIndex(long)
/ setDoubleAtIndex(long, double)
getBooleanAtIndex(long)
/ setBooleanAtIndex(long, boolean)
getSizeTAtIndex(long)
/ setSizeTAtIndex(long, long)
getCLongAtIndex(long)
/ setCLongAtIndex(long, long)
getIntAtOffset(long)
/ setIntAtOffset(long, int)
getLongAtOffset(long)
/ setLongAtOffset(long, long)
getShortAtOffset(long)
/ setShortAtOffset(long, short)
getByteAtOffset(long)
/ setByteAtOffset(long, byte)
getCharAtOffset(long)
/ setCharAtOffset(long, char)
getFloatAtOffset(long)
/ setFloatAtOffset(long, float)
getDoubleAtOffset(long)
/ setDoubleAtOffset(long, double)
getBooleanAtOffset(long)
/ setBooleanAtOffset(long, boolean)
getSizeTAtOffset(long)
/ setSizeTAtOffset(long, long)
getCLongAtOffset(long)
/ setCLongAtOffset(long, long)
getInts(int)
/ setInts(int[])
; With an offset : getIntsAtOffset(long, int)
/ setIntsAtOffset(long, int[])
getLongs(int)
/ setLongs(long[])
; With an offset : getLongsAtOffset(long, int)
/ setLongsAtOffset(long, long[])
getShorts(int)
/ setShorts(short[])
; With an offset : getShortsAtOffset(long, int)
/ setShortsAtOffset(long, short[])
getBytes(int)
/ setBytes(byte[])
; With an offset : getBytesAtOffset(long, int)
/ setBytesAtOffset(long, byte[])
getChars(int)
/ setChars(char[])
; With an offset : getCharsAtOffset(long, int)
/ setCharsAtOffset(long, char[])
getFloats(int)
/ setFloats(float[])
; With an offset : getFloatsAtOffset(long, int)
/ setFloatsAtOffset(long, float[])
getDoubles(int)
/ setDoubles(double[])
; With an offset : getDoublesAtOffset(long, int)
/ setDoublesAtOffset(long, double[])
getBooleans(int)
/ setBooleans(boolean[])
; With an offset : getBooleansAtOffset(long, int)
/ setBooleansAtOffset(long, boolean[])
getSizeTs(int)
/ setSizeTs(long[])
; With an offset : getSizeTsAtOffset(long, int)
/ setSizeTsAtOffset(long, long[])
getCLongs(int)
/ setCLongs(long[])
; With an offset : getCLongsAtOffset(long, int)
/ setCLongsAtOffset(long, long[])
getIntBuffer(long)
(can be used for writing as well) / setInts(IntBuffer)
getLongBuffer(long)
(can be used for writing as well) / setLongs(LongBuffer)
getShortBuffer(long)
(can be used for writing as well) / setShorts(ShortBuffer)
getByteBuffer(long)
(can be used for writing as well) / setBytes(ByteBuffer)
getFloatBuffer(long)
(can be used for writing as well) / setFloats(FloatBuffer)
getDoubleBuffer(long)
(can be used for writing as well) / setDoubles(DoubleBuffer)
getCString()
/ setCString(String)
; With an offset : getCStringAtOffset(long)
/ setCStringAtOffset(long, String)
getWideCString()
/ setWideCString(String)
; With an offset : getWideCStringAtOffset(long)
/ setWideCStringAtOffset(long, String)
getStringAtOffset(long, StringType, Charset)
/ setStringAtOffset(long, String, StringType, Charset)
Allocating memory
getPointer(NativeObject)
Callback
definition, which would be the preferred way) :allocateDynamicCallback(DynamicCallback, org.bridj.ann.Convention.Style, Type, Type[])
pointerToInt(int)
/ allocateInt()
pointerToLong(long)
/ allocateLong()
pointerToShort(short)
/ allocateShort()
pointerToByte(byte)
/ allocateByte()
pointerToChar(char)
/ allocateChar()
pointerToFloat(float)
/ allocateFloat()
pointerToDouble(double)
/ allocateDouble()
pointerToBoolean(boolean)
/ allocateBoolean()
pointerToSizeT(long)
/ allocateSizeT()
pointerToCLong(long)
/ allocateCLong()
pointerToInts(int[])
or pointerToInts(IntBuffer)
/ allocateInts(long)
pointerToLongs(long[])
or pointerToLongs(LongBuffer)
/ allocateLongs(long)
pointerToShorts(short[])
or pointerToShorts(ShortBuffer)
/ allocateShorts(long)
pointerToBytes(byte[])
or pointerToBytes(ByteBuffer)
/ allocateBytes(long)
pointerToChars(char[])
or pointerToChars(CharBuffer)
/ allocateChars(long)
pointerToFloats(float[])
or pointerToFloats(FloatBuffer)
/ allocateFloats(long)
pointerToDoubles(double[])
or pointerToDoubles(DoubleBuffer)
/ allocateDoubles(long)
pointerToSizeTs(long[])
/ allocateSizeTs(long)
pointerToCLongs(long[])
/ allocateCLongs(long)
pointerToBuffer(Buffer)
/ n/apointerToCString(String)
(default charset)pointerToWideCString(String)
(default charset)pointerToString(String, StringType, Charset)
Pointer.ListType.Dynamic
Java List
that uses native memory storage (think of getting back the pointer with NativeList.getPointer()
when you're done mutating the list):allocateList(Class, long)
List
that uses the pointer as storage (think of getting back the pointer with NativeList.getPointer()
when you're done mutating the list, if it's Pointer.ListType.Dynamic
) :asList(ListType)
asList()
Casting pointers
DynamicFunction
:asDynamicFunction(org.bridj.ann.Convention.Style, java.lang.reflect.Type, java.lang.reflect.Type[])
StructObject
or a Callback
(as the ones generated by JNAerator) as(Class)
CPPType.getCPPType(Object[])
to create a C++ template type, for instance) :as(Type)
asUntyped()
Dealing with pointer bounds
offset(long)
, next(long)
and other similar methods retain pointer bounds
getValidBytes()
and getValidElements()
return the amount of valid memory readable from the pointer
validBytes(long)
(useful for memory allocated by native code)
Modifier and Type | Class and Description |
---|---|
static class |
Pointer.ListType
Types of pointer-based list implementations that can be created through
asList() or asList(ListType) . |
static interface |
Pointer.Releaser
Object responsible for reclamation of some pointed memory when it's not used anymore.
|
static class |
Pointer.StringType
Type of a native character string.
|
Modifier and Type | Field and Description |
---|---|
static int |
defaultAlignment
Default alignment used to allocate memory from the static factory methods in Pointer class (any value lower or equal to 1 means no alignment)
|
static Pointer<?> |
NULL
The NULL pointer is always Java's null value
|
static int |
SIZE
Size of a pointer in bytes.
|
Modifier and Type | Method and Description |
---|---|
static <V> Pointer<V> |
allocate(Class<V> elementClass)
Create a memory area large enough to a single items of type elementClass.
|
static <V> Pointer<V> |
allocate(PointerIO<V> io)
Create a memory area large enough to hold one item of the type associated to the provided PointerIO instance (see
PointerIO.getTargetType() ) |
static <V> Pointer<V> |
allocate(Type elementClass)
Create a memory area large enough to a single items of type elementClass.
|
static <V> Pointer<V> |
allocateAlignedArray(Class<V> elementClass,
long arrayLength,
int alignment)
Create a memory area large enough to hold arrayLength items of type elementClass, ensuring the pointer to the memory is aligned to the provided boundary.
|
static <V> Pointer<V> |
allocateAlignedArray(Type elementClass,
long arrayLength,
int alignment)
Create a memory area large enough to hold arrayLength items of type elementClass, ensuring the pointer to the memory is aligned to the provided boundary.
|
static <V> Pointer<V> |
allocateAlignedBytes(PointerIO<V> io,
long byteSize,
int alignment,
Pointer.Releaser beforeDeallocation)
Create a memory area large enough to hold byteSize consecutive bytes and return a pointer to elements of the type associated to the provided PointerIO instance (see
PointerIO.getTargetType() ), ensuring the pointer to the memory is aligned to the provided boundary. |
static <V> Pointer<V> |
allocateArray(Class<V> elementClass,
long arrayLength)
Create a memory area large enough to hold arrayLength items of type elementClass.
|
static <V> Pointer<V> |
allocateArray(PointerIO<V> io,
long arrayLength)
Create a memory area large enough to hold arrayLength items of the type associated to the provided PointerIO instance (see
PointerIO.getTargetType() ) |
static <V> Pointer<V> |
allocateArray(PointerIO<V> io,
long arrayLength,
Pointer.Releaser beforeDeallocation)
Create a memory area large enough to hold arrayLength items of the type associated to the provided PointerIO instance (see
PointerIO.getTargetType() ) |
static <V> Pointer<V> |
allocateArray(Type elementClass,
long arrayLength)
Create a memory area large enough to hold arrayLength items of type elementClass.
|
static Pointer<Boolean> |
allocateBoolean()
Allocate enough memory for a boolean value and return a pointer to it.
|
static Pointer<Boolean> |
allocateBooleans(long arrayLength)
Allocate enough memory for arrayLength boolean values and return a pointer to that memory.
|
static Pointer<Pointer<Boolean>> |
allocateBooleans(long dim1,
long dim2)
Allocate enough memory for dim1 * dim2 boolean values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Boolean>>> |
allocateBooleans(long dim1,
long dim2,
long dim3)
Allocate enough memory for dim1 * dim2 * dim3 boolean values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Byte> |
allocateByte()
Allocate enough memory for a byte value and return a pointer to it.
|
static Pointer<Byte> |
allocateBytes(long arrayLength)
Allocate enough memory for arrayLength byte values and return a pointer to that memory.
|
static Pointer<Pointer<Byte>> |
allocateBytes(long dim1,
long dim2)
Allocate enough memory for dim1 * dim2 byte values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Byte>>> |
allocateBytes(long dim1,
long dim2,
long dim3)
Allocate enough memory for dim1 * dim2 * dim3 byte values in a packed multi-dimensional C array and return a pointer to that memory.
|
static <V> Pointer<V> |
allocateBytes(PointerIO<V> io,
long byteSize,
Pointer.Releaser beforeDeallocation)
Create a memory area large enough to hold byteSize consecutive bytes and return a pointer to elements of the type associated to the provided PointerIO instance (see
PointerIO.getTargetType() ) |
static Pointer<Character> |
allocateChar()
Allocate enough memory for a char value and return a pointer to it.
|
static Pointer<Character> |
allocateChars(long arrayLength)
Allocate enough memory for arrayLength char values and return a pointer to that memory.
|
static Pointer<Pointer<Character>> |
allocateChars(long dim1,
long dim2)
Allocate enough memory for dim1 * dim2 char values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Character>>> |
allocateChars(long dim1,
long dim2,
long dim3)
Allocate enough memory for dim1 * dim2 * dim3 char values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<CLong> |
allocateCLong()
Allocate enough memory for a CLong value and return a pointer to it.
|
static Pointer<CLong> |
allocateCLongs(long arrayLength)
Allocate enough memory for arrayLength CLong values and return a pointer to that memory.
|
static Pointer<Double> |
allocateDouble()
Allocate enough memory for a double value and return a pointer to it.
|
static Pointer<Double> |
allocateDoubles(long arrayLength)
Allocate enough memory for arrayLength double values and return a pointer to that memory.
|
static Pointer<Pointer<Double>> |
allocateDoubles(long dim1,
long dim2)
Allocate enough memory for dim1 * dim2 double values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Double>>> |
allocateDoubles(long dim1,
long dim2,
long dim3)
Allocate enough memory for dim1 * dim2 * dim3 double values in a packed multi-dimensional C array and return a pointer to that memory.
|
static <R> Pointer<DynamicFunction<R>> |
allocateDynamicCallback(DynamicCallback<R> callback,
Convention.Style callingConvention,
Type returnType,
Type... parameterTypes)
Create a native callback which signature corresponds to the provided calling convention, return type and parameter types, and which redirects calls to the provided Java
DynamicCallback handler. |
static Pointer<Float> |
allocateFloat()
Allocate enough memory for a float value and return a pointer to it.
|
static Pointer<Float> |
allocateFloats(long arrayLength)
Allocate enough memory for arrayLength float values and return a pointer to that memory.
|
static Pointer<Pointer<Float>> |
allocateFloats(long dim1,
long dim2)
Allocate enough memory for dim1 * dim2 float values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Float>>> |
allocateFloats(long dim1,
long dim2,
long dim3)
Allocate enough memory for dim1 * dim2 * dim3 float values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Integer> |
allocateInt()
Allocate enough memory for a int value and return a pointer to it.
|
static Pointer<Integer> |
allocateInts(long arrayLength)
Allocate enough memory for arrayLength int values and return a pointer to that memory.
|
static Pointer<Pointer<Integer>> |
allocateInts(long dim1,
long dim2)
Allocate enough memory for dim1 * dim2 int values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Integer>>> |
allocateInts(long dim1,
long dim2,
long dim3)
Allocate enough memory for dim1 * dim2 * dim3 int values in a packed multi-dimensional C array and return a pointer to that memory.
|
static <E> NativeList<E> |
allocateList(Class<E> type,
long capacity)
Create a
Pointer.ListType.Dynamic list with the provided initial capacity (see Pointer.ListType.Dynamic ). |
static <E> NativeList<E> |
allocateList(PointerIO<E> io,
long capacity)
Create a
Pointer.ListType.Dynamic list with the provided initial capacity (see Pointer.ListType.Dynamic ). |
static <E> NativeList<E> |
allocateList(Type type,
long capacity)
Create a
Pointer.ListType.Dynamic list with the provided initial capacity (see Pointer.ListType.Dynamic ). |
static Pointer<Long> |
allocateLong()
Allocate enough memory for a long value and return a pointer to it.
|
static Pointer<Long> |
allocateLongs(long arrayLength)
Allocate enough memory for arrayLength long values and return a pointer to that memory.
|
static Pointer<Pointer<Long>> |
allocateLongs(long dim1,
long dim2)
Allocate enough memory for dim1 * dim2 long values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Long>>> |
allocateLongs(long dim1,
long dim2,
long dim3)
Allocate enough memory for dim1 * dim2 * dim3 long values in a packed multi-dimensional C array and return a pointer to that memory.
|
static <V> Pointer<Pointer<?>> |
allocatePointer()
Create a memory area large enough to hold an untyped pointer.
|
static <P> Pointer<Pointer<P>> |
allocatePointer(Class<P> targetType)
Create a memory area large enough to hold a pointer.
|
static <P> Pointer<Pointer<P>> |
allocatePointer(Type targetType)
Create a memory area large enough to hold a pointer.
|
static <P> Pointer<Pointer<Pointer<P>>> |
allocatePointerPointer(Class<P> targetType)
Create a memory area large enough to hold a pointer to a pointer
|
static <P> Pointer<Pointer<Pointer<P>>> |
allocatePointerPointer(Type targetType)
Create a memory area large enough to hold a pointer to a pointer
|
static <P> Pointer<Pointer<P>> |
allocatePointers(Class<P> targetType,
int arrayLength)
Create a memory area large enough to hold an array of arrayLength typed pointers.
|
static Pointer<Pointer<?>> |
allocatePointers(int arrayLength)
Allocate enough memory for arrayLength untyped pointer values and return a pointer to that memory.
|
static <P> Pointer<Pointer<P>> |
allocatePointers(Type targetType,
int arrayLength)
Create a memory area large enough to hold an array of arrayLength typed pointers.
|
static Pointer<Short> |
allocateShort()
Allocate enough memory for a short value and return a pointer to it.
|
static Pointer<Short> |
allocateShorts(long arrayLength)
Allocate enough memory for arrayLength short values and return a pointer to that memory.
|
static Pointer<Pointer<Short>> |
allocateShorts(long dim1,
long dim2)
Allocate enough memory for dim1 * dim2 short values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Short>>> |
allocateShorts(long dim1,
long dim2,
long dim3)
Allocate enough memory for dim1 * dim2 * dim3 short values in a packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<SizeT> |
allocateSizeT()
Allocate enough memory for a SizeT value and return a pointer to it.
|
static Pointer<SizeT> |
allocateSizeTs(long arrayLength)
Allocate enough memory for arrayLength SizeT values and return a pointer to that memory.
|
static <P extends TypedPointer> |
allocateTypedPointer(Class<P> type)
Allocate enough memory for a typed pointer value and return a pointer to it.
|
static <P extends TypedPointer> |
allocateTypedPointers(Class<P> type,
long arrayLength)
Allocate enough memory for arrayLength typed pointer values and return a pointer to that memory.
|
T |
apply(long index)
Alias for
get(long) defined for more natural use from the Scala language. |
<U> Pointer<U> |
as(Class<U> type)
Cast this pointer to another pointer type.
|
<U> Pointer<U> |
as(PointerIO<U> newIO)
Cast this pointer to another pointer type
|
<U> Pointer<U> |
as(Type type)
Cast this pointer to another pointer type
Synonym of as(Class) The following C code :
Can be translated to the following Java code :
|
<R> DynamicFunction<R> |
asDynamicFunction(Convention.Style callingConvention,
Type returnType,
Type... parameterTypes)
Cast this pointer as a function pointer to a function that returns the specified return type and takes the specified parameter types.
|
NativeList<T> |
asList()
Create a
Pointer.ListType.FixedCapacity native list that uses this pointer as storage (and has this pointer's pointed valid elements as initial content). |
NativeList<T> |
asList(Pointer.ListType type)
Create a native list that uses this pointer as initial storage (and has this pointer's pointed valid elements as initial content).
|
Pointer<?> |
asUntyped()
Cast this pointer to an untyped pointer.
|
void |
clearBytes(long length)
Write zero bytes to the first length bytes pointed by this pointer
|
void |
clearBytesAtOffset(long byteOffset,
long length,
byte value)
Write a byte
value to each of the length bytes at the address pointed to by this pointer shifted by a byteOffset |
void |
clearValidBytes()
Write zero bytes to all of the valid bytes pointed by this pointer
|
Pointer<T> |
clone()
Creates a copy of the pointed memory location (allocates a new area of memory) and returns a pointer to it.
|
int |
compareBytes(Pointer<?> other,
long byteCount)
Compare the byteCount bytes at the memory location pointed by this pointer to the byteCount bytes at the memory location pointer by other using the C memcmp function.
|
int |
compareBytesAtOffset(long byteOffset,
Pointer<?> other,
long otherByteOffset,
long byteCount)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues)
|
int |
compareTo(Pointer<?> p)
Compare to another pointer based on pointed addresses.
|
Pointer<T> |
copyBytesAtOffsetTo(long byteOffset,
Pointer<?> destination,
long byteOffsetInDestination,
long byteCount)
Deprecated.
|
Pointer<T> |
copyBytesTo(Pointer<?> destination,
long byteCount)
Deprecated.
|
Pointer<T> |
copyTo(Pointer<?> destination)
Copy remaining bytes from this pointer to a destination using the memcpy C function (see
copyBytesTo(Pointer, long) , getValidBytes() ) |
Pointer<T> |
copyTo(Pointer<?> destination,
long elementCount)
Copy remaining elements from this pointer to a destination using the memcpy C function (see
copyBytesAtOffsetTo(long, Pointer, long, long) , getValidBytes() ) |
boolean |
equals(Object obj)
Test equality of the pointer using the address.
|
Pointer<T> |
find(Pointer<?> needle)
Find the first appearance of the sequence of valid bytes pointed by needle in the memory area pointed to by this bounded pointer (behaviour equivalent to memmem, which is used underneath on platforms where it is available)
|
Pointer<T> |
findByte(long byteOffset,
byte value,
long searchLength)
Find the first occurrence of a value in the memory block of length searchLength bytes pointed by this pointer shifted by a byteOffset
|
Pointer<T> |
findLast(Pointer<?> needle)
Find the last appearance of the sequence of valid bytes pointed by needle in the memory area pointed to by this bounded pointer (also see
find(Pointer) ). |
T |
get()
Dereference this pointer (*ptr).
|
T |
get(long index)
Gets the n-th element from this pointer.
|
static <T> T |
get(Pointer<T> pointer)
Returns null if pointer is null, otherwise dereferences the pointer (calls pointer.get()).
|
static long |
getAddress(NativeObject instance,
Class targetType)
Get the address of a native object, specifying the type of the pointer's target (same as
getPointer(instance, targetType).getPeer() , see getPointer(NativeObject, Type) ). |
Object |
getArray()
Read the array of remaining elements from the pointed memory location.
|
Object |
getArray(int length)
Read an array of elements from the pointed memory location.
|
Object |
getArrayAtOffset(long byteOffset,
int length)
Read an array of elements from the pointed memory location shifted by a byte offset.
|
abstract boolean |
getBoolean()
Read a boolean value from the pointed memory location
|
boolean |
getBooleanAtIndex(long valueIndex)
Read the nth contiguous boolean value from the pointed memory location.
|
abstract boolean |
getBooleanAtOffset(long byteOffset)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getBoolean() over this method. |
boolean[] |
getBooleans()
Read the array of remaining boolean values from the pointed memory location
|
boolean[] |
getBooleans(int length)
Read an array of boolean values of the specified length from the pointed memory location
|
boolean[] |
getBooleansAtOffset(long byteOffset,
int length)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getBooleans(int) over this method. |
<B extends Buffer> |
getBuffer()
Read the NIO
Buffer of remaining elements from the pointed memory location. |
<B extends Buffer> |
getBuffer(int length)
Read an NIO
Buffer of elements from the pointed memory location. |
<B extends Buffer> |
getBufferAtOffset(long byteOffset,
int length)
Read an NIO
Buffer of elements from the pointed memory location shifted by a byte offset. |
abstract byte |
getByte()
Read a byte value from the pointed memory location
|
byte |
getByteAtIndex(long valueIndex)
Read the nth contiguous byte value from the pointed memory location.
|
abstract byte |
getByteAtOffset(long byteOffset)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getByte() over this method. |
ByteBuffer |
getByteBuffer()
Get a direct buffer of byte values that points to this pointer's target memory locations
|
ByteBuffer |
getByteBuffer(long length)
Get a direct buffer of byte values of the specified length that points to this pointer's target memory location
|
ByteBuffer |
getByteBufferAtOffset(long byteOffset,
long length)
Get a direct buffer of byte values of the specified length that points to this pointer's target memory location shifted by a byte offset
|
byte[] |
getBytes()
Read the array of remaining byte values from the pointed memory location
|
void |
getBytes(byte[] dest)
Read byte values into the specified destination array from the pointed memory location
|
void |
getBytes(ByteBuffer dest)
Read byte values into the specified destination buffer from the pointed memory location
|
byte[] |
getBytes(int length)
Read an array of byte values of the specified length from the pointed memory location
|
void |
getBytesAtOffset(long byteOffset,
byte[] dest,
int destOffset,
int length)
Read length byte values into the specified destination array from the pointed memory location shifted by a byte offset, storing values after the provided destination offset.
|
byte[] |
getBytesAtOffset(long byteOffset,
int length)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getBytes(int) over this method. |
abstract char |
getChar()
Read a char value from the pointed memory location
|
char |
getCharAtIndex(long valueIndex)
Read the nth contiguous char value from the pointed memory location.
|
abstract char |
getCharAtOffset(long byteOffset)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getChar() over this method. |
char[] |
getChars()
Read the array of remaining char values from the pointed memory location
|
char[] |
getChars(int length)
Read an array of char values of the specified length from the pointed memory location
|
char[] |
getCharsAtOffset(long byteOffset,
int length)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getChars(int) over this method. |
long |
getCLong()
Read a CLong value from the pointed memory location
|
long |
getCLongAtIndex(long valueIndex)
Read the nth contiguous CLong value from the pointed memory location.
|
long |
getCLongAtOffset(long byteOffset)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getCLong() over this method. |
long[] |
getCLongs()
Read the array of remaining CLong values from the pointed memory location
|
long[] |
getCLongs(int arrayLength)
Read an array of CLong values of the specified length from the pointed memory location
|
long[] |
getCLongsAtOffset(long byteOffset,
int arrayLength)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getCLongs(int) over this method. |
String |
getCString()
Read a C string using the default charset from the pointed memory location (see
Pointer.StringType.C ). |
String |
getCStringAtOffset(long byteOffset)
Read a C string using the default charset from the pointed memory location shifted by a byte offset (see
Pointer.StringType.C ). |
abstract double |
getDouble()
Read a double value from the pointed memory location
|
double |
getDoubleAtIndex(long valueIndex)
Read the nth contiguous double value from the pointed memory location.
|
abstract double |
getDoubleAtOffset(long byteOffset)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getDouble() over this method. |
DoubleBuffer |
getDoubleBuffer()
Get a direct buffer of double values that points to this pointer's target memory locations
|
DoubleBuffer |
getDoubleBuffer(long length)
Get a direct buffer of double values of the specified length that points to this pointer's target memory location
|
DoubleBuffer |
getDoubleBufferAtOffset(long byteOffset,
long length)
Get a direct buffer of double values of the specified length that points to this pointer's target memory location shifted by a byte offset
|
double[] |
getDoubles()
Read the array of remaining double values from the pointed memory location
|
void |
getDoubles(double[] dest)
Read double values into the specified destination array from the pointed memory location
|
void |
getDoubles(DoubleBuffer dest)
Read double values into the specified destination buffer from the pointed memory location
|
double[] |
getDoubles(int length)
Read an array of double values of the specified length from the pointed memory location
|
void |
getDoublesAtOffset(long byteOffset,
double[] dest,
int destOffset,
int length)
Read length double values into the specified destination array from the pointed memory location shifted by a byte offset, storing values after the provided destination offset.
|
double[] |
getDoublesAtOffset(long byteOffset,
int length)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getDoubles(int) over this method. |
abstract float |
getFloat()
Read a float value from the pointed memory location
|
float |
getFloatAtIndex(long valueIndex)
Read the nth contiguous float value from the pointed memory location.
|
abstract float |
getFloatAtOffset(long byteOffset)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getFloat() over this method. |
FloatBuffer |
getFloatBuffer()
Get a direct buffer of float values that points to this pointer's target memory locations
|
FloatBuffer |
getFloatBuffer(long length)
Get a direct buffer of float values of the specified length that points to this pointer's target memory location
|
FloatBuffer |
getFloatBufferAtOffset(long byteOffset,
long length)
Get a direct buffer of float values of the specified length that points to this pointer's target memory location shifted by a byte offset
|
float[] |
getFloats()
Read the array of remaining float values from the pointed memory location
|
void |
getFloats(float[] dest)
Read float values into the specified destination array from the pointed memory location
|
void |
getFloats(FloatBuffer dest)
Read float values into the specified destination buffer from the pointed memory location
|
float[] |
getFloats(int length)
Read an array of float values of the specified length from the pointed memory location
|
void |
getFloatsAtOffset(long byteOffset,
float[] dest,
int destOffset,
int length)
Read length float values into the specified destination array from the pointed memory location shifted by a byte offset, storing values after the provided destination offset.
|
float[] |
getFloatsAtOffset(long byteOffset,
int length)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getFloats(int) over this method. |
abstract int |
getInt()
Read a int value from the pointed memory location
|
int |
getIntAtIndex(long valueIndex)
Read the nth contiguous int value from the pointed memory location.
|
abstract int |
getIntAtOffset(long byteOffset)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getInt() over this method. |
IntBuffer |
getIntBuffer()
Get a direct buffer of int values that points to this pointer's target memory locations
|
IntBuffer |
getIntBuffer(long length)
Get a direct buffer of int values of the specified length that points to this pointer's target memory location
|
IntBuffer |
getIntBufferAtOffset(long byteOffset,
long length)
Get a direct buffer of int values of the specified length that points to this pointer's target memory location shifted by a byte offset
|
long |
getIntegralAtOffset(long byteOffset,
int integralSize) |
int[] |
getInts()
Read the array of remaining int values from the pointed memory location
|
int[] |
getInts(int length)
Read an array of int values of the specified length from the pointed memory location
|
void |
getInts(int[] dest)
Read int values into the specified destination array from the pointed memory location
|
void |
getInts(IntBuffer dest)
Read int values into the specified destination buffer from the pointed memory location
|
int[] |
getIntsAtOffset(long byteOffset,
int length)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getInts(int) over this method. |
void |
getIntsAtOffset(long byteOffset,
int[] dest,
int destOffset,
int length)
Read length int values into the specified destination array from the pointed memory location shifted by a byte offset, storing values after the provided destination offset.
|
PointerIO<T> |
getIO()
Get the PointerIO instance used by this pointer to get and set pointed values.
|
abstract long |
getLong()
Read a long value from the pointed memory location
|
long |
getLongAtIndex(long valueIndex)
Read the nth contiguous long value from the pointed memory location.
|
abstract long |
getLongAtOffset(long byteOffset)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getLong() over this method. |
LongBuffer |
getLongBuffer()
Get a direct buffer of long values that points to this pointer's target memory locations
|
LongBuffer |
getLongBuffer(long length)
Get a direct buffer of long values of the specified length that points to this pointer's target memory location
|
LongBuffer |
getLongBufferAtOffset(long byteOffset,
long length)
Get a direct buffer of long values of the specified length that points to this pointer's target memory location shifted by a byte offset
|
long[] |
getLongs()
Read the array of remaining long values from the pointed memory location
|
long[] |
getLongs(int length)
Read an array of long values of the specified length from the pointed memory location
|
void |
getLongs(long[] dest)
Read long values into the specified destination array from the pointed memory location
|
void |
getLongs(LongBuffer dest)
Read long values into the specified destination buffer from the pointed memory location
|
long[] |
getLongsAtOffset(long byteOffset,
int length)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getLongs(int) over this method. |
void |
getLongsAtOffset(long byteOffset,
long[] dest,
int destOffset,
int length)
Read length long values into the specified destination array from the pointed memory location shifted by a byte offset, storing values after the provided destination offset.
|
<O extends NativeObject> |
getNativeObject(Class<O> type)
Read a native object value from the pointed memory location
|
<O extends NativeObject> |
getNativeObject(Type type)
Read a native object value from the pointed memory location
|
<O extends NativeObject> |
getNativeObjectAtOffset(long byteOffset,
Class<O> type)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getNativeObject(Class) over this method. |
<O extends NativeObject> |
getNativeObjectAtOffset(long byteOffset,
Type type)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getNativeObject(Type) over this method. |
long |
getPeer()
Get the address of the memory pointed to by this pointer ("cast this pointer to long", in C jargon).
|
static long |
getPeer(Pointer<?> pointer)
Get a pointer's peer (see
getPeer() ), or zero if the pointer is null. |
Pointer<?> |
getPointer()
Deprecated.
Avoid using untyped pointers, if possible.
|
<U> Pointer<U> |
getPointer(Class<U> c)
Read a pointer value from the pointed memory location.
|
static <N extends NativeObject> |
getPointer(N instance)
Get a pointer to a native object (C++ or ObjectiveC class, struct, union, callback...)
|
static <N extends NativeObjectInterface> |
getPointer(N instance)
Get a pointer to a native object (C++ or ObjectiveC class, struct, union, callback...)
|
static <R extends NativeObject> |
getPointer(NativeObject instance,
Type targetType)
Get a pointer to a native object, specifying the type of the pointer's target.
|
<U> Pointer<U> |
getPointer(PointerIO<U> pio)
Read a pointer value from the pointed memory location
|
Pointer<?> |
getPointerAtIndex(long valueIndex)
Read the nth contiguous pointer value from the pointed memory location.
|
Pointer<?> |
getPointerAtOffset(long byteOffset)
Read a pointer value from the pointed memory location shifted by a byte offset
|
<U> Pointer<U> |
getPointerAtOffset(long byteOffset,
Class<U> c)
Read a pointer value from the pointed memory location shifted by a byte offset
|
<U> Pointer<U> |
getPointerAtOffset(long byteOffset,
PointerIO<U> pio)
Read a pointer value from the pointed memory location shifted by a byte offset
|
<U> Pointer<U> |
getPointerAtOffset(long byteOffset,
Type t)
Read a pointer value from the pointed memory location shifted by a byte offset
|
Pointer<?>[] |
getPointers()
Deprecated.
Use a typed version instead :
getPointersAtOffset(long, int, Type) , getPointersAtOffset(long, int, Class) or getPointersAtOffset(long, int, PointerIO) |
Pointer<?>[] |
getPointers(int arrayLength)
Deprecated.
Use a typed version instead :
getPointersAtOffset(long, int, Type) , getPointersAtOffset(long, int, Class) or getPointersAtOffset(long, int, PointerIO) |
Pointer<?>[] |
getPointersAtOffset(long byteOffset,
int arrayLength)
Deprecated.
Use a typed version instead :
getPointersAtOffset(long, int, Type) , getPointersAtOffset(long, int, Class) or getPointersAtOffset(long, int, PointerIO) |
<U> Pointer<U>[] |
getPointersAtOffset(long byteOffset,
int arrayLength,
Class<U> t)
Read an array of pointer values from the pointed memory location shifted by a byte offset
|
<U> Pointer<U>[] |
getPointersAtOffset(long byteOffset,
int arrayLength,
PointerIO pio)
Read an array of pointer values from the pointed memory location shifted by a byte offset
|
<U> Pointer<U>[] |
getPointersAtOffset(long byteOffset,
int arrayLength,
Type t)
Read an array of pointer values from the pointed memory location shifted by a byte offset
|
Pointer<Pointer<T>> |
getReference()
Returns a pointer to this pointer.
|
abstract short |
getShort()
Read a short value from the pointed memory location
|
short |
getShortAtIndex(long valueIndex)
Read the nth contiguous short value from the pointed memory location.
|
abstract short |
getShortAtOffset(long byteOffset)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getShort() over this method. |
ShortBuffer |
getShortBuffer()
Get a direct buffer of short values that points to this pointer's target memory locations
|
ShortBuffer |
getShortBuffer(long length)
Get a direct buffer of short values of the specified length that points to this pointer's target memory location
|
ShortBuffer |
getShortBufferAtOffset(long byteOffset,
long length)
Get a direct buffer of short values of the specified length that points to this pointer's target memory location shifted by a byte offset
|
short[] |
getShorts()
Read the array of remaining short values from the pointed memory location
|
short[] |
getShorts(int length)
Read an array of short values of the specified length from the pointed memory location
|
void |
getShorts(short[] dest)
Read short values into the specified destination array from the pointed memory location
|
void |
getShorts(ShortBuffer dest)
Read short values into the specified destination buffer from the pointed memory location
|
short[] |
getShortsAtOffset(long byteOffset,
int length)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getShorts(int) over this method. |
void |
getShortsAtOffset(long byteOffset,
short[] dest,
int destOffset,
int length)
Read length short values into the specified destination array from the pointed memory location shifted by a byte offset, storing values after the provided destination offset.
|
long |
getSizeT()
Read a SizeT value from the pointed memory location
|
long |
getSizeTAtIndex(long valueIndex)
Read the nth contiguous SizeT value from the pointed memory location.
|
long |
getSizeTAtOffset(long byteOffset)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getSizeT() over this method. |
long[] |
getSizeTs()
Read the array of remaining SizeT values from the pointed memory location
|
long[] |
getSizeTs(int arrayLength)
Read an array of SizeT values of the specified length from the pointed memory location
|
long[] |
getSizeTsAtOffset(long byteOffset,
int arrayLength)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
getSizeTs(int) over this method. |
String |
getString(Pointer.StringType type)
Read a native string from the pointed memory location using the default charset.
|
String |
getString(Pointer.StringType type,
Charset charset)
Read a native string from the pointed memory location, using the provided charset or the system's default if not provided.
|
String |
getStringAtOffset(long byteOffset,
Pointer.StringType type,
Charset charset)
Read a native string from the pointed memory location shifted by a byte offset, using the provided charset or the system's default if not provided.
|
long |
getTargetSize()
Get the unitary size of the pointed elements in bytes.
|
Type |
getTargetType()
Get the type of pointed elements.
|
long |
getValidBytes()
Get the amount of memory known to be valid from this pointer, or -1 if it is unknown.
|
long |
getValidElements()
Get the amount of memory known to be valid from this pointer (expressed in elements of the target type, see
getTargetType() ) or -1 if it is unknown. |
String |
getWideCString()
Read a WideC string using the default charset from the pointed memory location (see
Pointer.StringType.WideC ). |
String |
getWideCStringAtOffset(long byteOffset)
Read a WideC string using the default charset from the pointed memory location shifted by a byte offset (see
Pointer.StringType.WideC ). |
int |
hashCode()
Compute a hash code based on pointed address.
|
static <E extends Enum<E>> |
intEnumType(Class<? extends IntValuedEnum<E>> targetType)
Create a
IntValuedEnum<T> type. |
boolean |
isAligned()
Check that the pointer's peer is aligned to the target type alignment.
|
boolean |
isAligned(long alignment)
Check that the pointer's peer is aligned to the given alignment.
|
abstract boolean |
isOrdered()
Whether this pointer reads data in the system's native byte order or not.
|
ListIterator<T> |
iterator()
Returns an iterator over the elements pointed by this pointer.
|
Pointer<T> |
moveBytesAtOffsetTo(long byteOffset,
Pointer<?> destination,
long byteOffsetInDestination,
long byteCount)
Deprecated.
|
Pointer<T> |
moveBytesTo(Pointer<?> destination)
Copy all valid bytes from the memory location indicated by this pointer to that of another pointer, using the memmove C function.
|
Pointer<T> |
moveBytesTo(Pointer<?> destination,
long byteCount)
Copy bytes from the memory location indicated by this pointer to that of another pointer, using the memmove C function.
|
Pointer<T> |
next()
Returns a pointer to the next target.
|
Pointer<T> |
next(long delta)
Returns a pointer to the n-th next (or previous) target.
|
Pointer<T> |
offset(long byteOffset)
Returns a pointer which address value was obtained by this pointer's by adding a byte offset.
|
ByteOrder |
order()
Get the byte order (endianness) of this pointer.
|
Pointer<T> |
order(ByteOrder order)
Create a view of this pointer that has the byte order provided in argument, or return this if this pointer already uses the requested byte order.
|
static <N extends NativeObject> |
pointerTo(N instance)
Deprecated.
Will be removed in a future version, please use
getPointer(NativeObject) instead. |
static Pointer<?> |
pointerToAddress(long peer)
Deprecated.
|
static <P> Pointer<P> |
pointerToAddress(long peer,
Class<P> targetClass)
Deprecated.
|
static <P> Pointer<P> |
pointerToAddress(long peer,
Class<P> targetClass,
Pointer.Releaser releaser)
Create a pointer out of a native memory address
|
static Pointer<?> |
pointerToAddress(long peer,
long size)
Deprecated.
|
static Pointer<?> |
pointerToAddress(long peer,
long size,
Pointer.Releaser releaser)
Create a pointer out of a native memory address
|
static <P> Pointer<P> |
pointerToAddress(long peer,
long size,
PointerIO<P> io,
Pointer.Releaser releaser)
Create a pointer out of a native memory address
|
static Pointer<?> |
pointerToAddress(long peer,
Pointer.Releaser releaser)
Deprecated.
|
static <P> Pointer<P> |
pointerToAddress(long peer,
PointerIO<P> io)
Create a pointer out of a native memory address
|
static <P> Pointer<P> |
pointerToAddress(long peer,
Type targetType)
Deprecated.
|
static <P> Pointer<P> |
pointerToAddress(long peer,
Type targetType,
Pointer.Releaser releaser)
Create a pointer out of a native memory address
|
static <T> Pointer<T> |
pointerToArray(Object array)
Allocate enough memory for array.length values, copy the values of the array provided as argument into it and return a pointer to that memory.
|
static Pointer<Boolean> |
pointerToBoolean(boolean value)
Allocate enough memory for a single boolean value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<Boolean> |
pointerToBooleans(boolean... values)
Allocate enough memory for values.length boolean values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<Pointer<Boolean>> |
pointerToBooleans(boolean[][] values)
Allocate enough memory for all the values in the 2D boolean array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Boolean>>> |
pointerToBooleans(boolean[][][] values)
Allocate enough memory for all the values in the 3D boolean array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<?> |
pointerToBuffer(Buffer buffer)
Create a pointer to the memory location used by a direct NIO buffer.
|
static Pointer<Byte> |
pointerToByte(byte value)
Allocate enough memory for a single byte value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<Byte> |
pointerToBytes(byte... values)
Allocate enough memory for values.length byte values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<Pointer<Byte>> |
pointerToBytes(byte[][] values)
Allocate enough memory for all the values in the 2D byte array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Byte>>> |
pointerToBytes(byte[][][] values)
Allocate enough memory for all the values in the 3D byte array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Byte> |
pointerToBytes(ByteBuffer buffer)
Create a pointer to the memory location used by a direct NIO ByteBuffer.
|
static Pointer<Character> |
pointerToChar(char value)
Allocate enough memory for a single char value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<Character> |
pointerToChars(char... values)
Allocate enough memory for values.length char values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<Pointer<Character>> |
pointerToChars(char[][] values)
Allocate enough memory for all the values in the 2D char array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Character>>> |
pointerToChars(char[][][] values)
Allocate enough memory for all the values in the 3D char array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Character> |
pointerToChars(CharBuffer buffer)
Create a pointer to the memory location used by a direct NIO CharBuffer.
|
static Pointer<CLong> |
pointerToCLong(CLong value)
Allocate enough memory for a single CLong value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<CLong> |
pointerToCLong(long value)
Allocate enough memory for a single CLong value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<CLong> |
pointerToCLongs(CLong... values)
Allocate enough memory for values.length CLong values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<CLong> |
pointerToCLongs(int[] values)
Allocate enough memory for values.length CLong values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<CLong> |
pointerToCLongs(long... values)
Allocate enough memory for values.length CLong values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<Byte> |
pointerToCString(String string)
Allocate memory and write a C string to it, using the system's default charset to convert the string.
|
static Pointer<Pointer<Byte>> |
pointerToCStrings(String... strings)
Allocate an array of pointers to strings.
|
static Pointer<Double> |
pointerToDouble(double value)
Allocate enough memory for a single double value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<Double> |
pointerToDoubles(double... values)
Allocate enough memory for values.length double values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<Pointer<Double>> |
pointerToDoubles(double[][] values)
Allocate enough memory for all the values in the 2D double array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Double>>> |
pointerToDoubles(double[][][] values)
Allocate enough memory for all the values in the 3D double array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Double> |
pointerToDoubles(DoubleBuffer buffer)
Create a pointer to the memory location used by a direct NIO DoubleBuffer.
|
static <E extends Enum<E>> |
pointerToEnum(IntValuedEnum<E> instance)
Get a pointer to an enum.
|
static Pointer<Float> |
pointerToFloat(float value)
Allocate enough memory for a single float value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<Float> |
pointerToFloats(float... values)
Allocate enough memory for values.length float values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<Pointer<Float>> |
pointerToFloats(float[][] values)
Allocate enough memory for all the values in the 2D float array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Float>>> |
pointerToFloats(float[][][] values)
Allocate enough memory for all the values in the 3D float array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Float> |
pointerToFloats(FloatBuffer buffer)
Create a pointer to the memory location used by a direct NIO FloatBuffer.
|
static Pointer<Integer> |
pointerToInt(int value)
Allocate enough memory for a single int value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<Integer> |
pointerToInts(int... values)
Allocate enough memory for values.length int values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<Pointer<Integer>> |
pointerToInts(int[][] values)
Allocate enough memory for all the values in the 2D int array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Integer>>> |
pointerToInts(int[][][] values)
Allocate enough memory for all the values in the 3D int array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Integer> |
pointerToInts(IntBuffer buffer)
Create a pointer to the memory location used by a direct NIO IntBuffer.
|
static Pointer<Long> |
pointerToLong(long value)
Allocate enough memory for a single long value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<Long> |
pointerToLongs(long... values)
Allocate enough memory for values.length long values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<Pointer<Long>> |
pointerToLongs(long[][] values)
Allocate enough memory for all the values in the 2D long array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Long>>> |
pointerToLongs(long[][][] values)
Allocate enough memory for all the values in the 3D long array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Long> |
pointerToLongs(LongBuffer buffer)
Create a pointer to the memory location used by a direct NIO LongBuffer.
|
static <T> Pointer<Pointer<T>> |
pointerToPointer(Pointer<T> value)
Allocate enough memory for a single pointer value, copy the value provided in argument into it and return a pointer to that memory.
|
static <T> Pointer<Pointer<T>> |
pointerToPointers(Pointer<T>... values)
Allocate enough memory for values.length pointer values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<Short> |
pointerToShort(short value)
Allocate enough memory for a single short value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<Short> |
pointerToShorts(short... values)
Allocate enough memory for values.length short values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<Pointer<Short>> |
pointerToShorts(short[][] values)
Allocate enough memory for all the values in the 2D short array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Pointer<Pointer<Short>>> |
pointerToShorts(short[][][] values)
Allocate enough memory for all the values in the 3D short array, copy the values provided as argument into it as packed multi-dimensional C array and return a pointer to that memory.
|
static Pointer<Short> |
pointerToShorts(ShortBuffer buffer)
Create a pointer to the memory location used by a direct NIO ShortBuffer.
|
static Pointer<SizeT> |
pointerToSizeT(long value)
Allocate enough memory for a single SizeT value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<SizeT> |
pointerToSizeT(SizeT value)
Allocate enough memory for a single SizeT value, copy the value provided in argument into it and return a pointer to that memory.
|
static Pointer<SizeT> |
pointerToSizeTs(int[] values)
Allocate enough memory for values.length SizeT values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<SizeT> |
pointerToSizeTs(long... values)
Allocate enough memory for values.length SizeT values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<SizeT> |
pointerToSizeTs(SizeT... values)
Allocate enough memory for values.length SizeT values, copy the values provided as argument into it and return a pointer to that memory.
|
static Pointer<?> |
pointerToString(String string,
Pointer.StringType type,
Charset charset)
Allocate memory and write a string to it, using the system's default charset to convert the string (See
Pointer.StringType for details on the supported types). |
static Pointer<Character> |
pointerToWideCString(String string)
Allocate memory and write a WideC string to it, using the system's default charset to convert the string.
|
static Pointer<Pointer<Character>> |
pointerToWideCStrings(String... strings)
Allocate an array of pointers to strings.
|
static Type |
pointerType(Type targetType)
Create a
Pointer<T> type. |
void |
release()
Manually release the memory pointed by this pointer if it was allocated on the Java side.
|
static void |
release(Pointer... pointers)
Release pointers, if they're not null (see
release() ). |
T |
set(long index,
T value)
Sets the n-th element from this pointer, and return it (different behaviour from
List.set(int, Object) which returns the old value of that element !!!). |
T |
set(T value)
Assign a value to the pointed memory location, and return it (different behaviour from
List.set(int, Object) which returns the old value of that element !!!). |
Pointer<T> |
setArray(Object array)
Write an array of elements to the pointed memory location.
|
Pointer<T> |
setArrayAtOffset(long byteOffset,
Object array)
Write an array of elements to the pointed memory location shifted by a byte offset.
|
abstract Pointer<T> |
setBoolean(boolean value)
Write a boolean value to the pointed memory location
|
Pointer<T> |
setBooleanAtIndex(long valueIndex,
boolean value)
Write the nth contiguous boolean value to the pointed memory location.
|
abstract Pointer<T> |
setBooleanAtOffset(long byteOffset,
boolean value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setBoolean(boolean) over this method. |
Pointer<T> |
setBooleans(boolean[] values)
Write an array of boolean values of the specified length to the pointed memory location
|
Pointer<T> |
setBooleansAtOffset(long byteOffset,
boolean[] values)
Write an array of boolean values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setBooleansAtOffset(long byteOffset,
boolean[] values,
int valuesOffset,
int length)
Write an array of boolean values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given array offset and for the given length from the provided array.
|
abstract Pointer<T> |
setByte(byte value)
Write a byte value to the pointed memory location
|
Pointer<T> |
setByteAtIndex(long valueIndex,
byte value)
Write the nth contiguous byte value to the pointed memory location.
|
abstract Pointer<T> |
setByteAtOffset(long byteOffset,
byte value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setByte(byte) over this method. |
Pointer<T> |
setBytes(byte[] values)
Write an array of byte values of the specified length to the pointed memory location
|
Pointer<T> |
setBytes(ByteBuffer values)
Write a buffer of byte values of the specified length to the pointed memory location
|
Pointer<T> |
setBytesAtOffset(long byteOffset,
byte[] values)
Write an array of byte values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setBytesAtOffset(long byteOffset,
byte[] values,
int valuesOffset,
int length)
Write an array of byte values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given array offset and for the given length from the provided array.
|
Pointer<T> |
setBytesAtOffset(long byteOffset,
ByteBuffer values)
Write a buffer of byte values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setBytesAtOffset(long byteOffset,
ByteBuffer values,
long valuesOffset,
long length)
Write a buffer of byte values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given buffer offset and for the given length from the provided buffer.
|
abstract Pointer<T> |
setChar(char value)
Write a char value to the pointed memory location
|
Pointer<T> |
setCharAtIndex(long valueIndex,
char value)
Write the nth contiguous char value to the pointed memory location.
|
abstract Pointer<T> |
setCharAtOffset(long byteOffset,
char value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setChar(char) over this method. |
Pointer<T> |
setChars(char[] values)
Write an array of char values of the specified length to the pointed memory location
|
Pointer<T> |
setChars(CharBuffer values)
Write a buffer of char values of the specified length to the pointed memory location
|
Pointer<T> |
setCharsAtOffset(long byteOffset,
char[] values)
Write an array of char values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setCharsAtOffset(long byteOffset,
char[] values,
int valuesOffset,
int length)
Write an array of char values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given array offset and for the given length from the provided array.
|
Pointer<T> |
setCharsAtOffset(long byteOffset,
CharBuffer values)
Write a buffer of char values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setCharsAtOffset(long byteOffset,
CharBuffer values,
long valuesOffset,
long length)
Write a buffer of char values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given buffer offset and for the given length from the provided buffer.
|
Pointer<T> |
setCLong(CLong value)
Write a CLong value to the pointed memory location
|
Pointer<T> |
setCLong(long value)
Write a CLong value to the pointed memory location
|
Pointer<T> |
setCLongAtIndex(long valueIndex,
long value)
Write the nth contiguous CLong value to the pointed memory location.
|
Pointer<T> |
setCLongAtOffset(long byteOffset,
CLong value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setCLong(CLong) over this method. |
Pointer<T> |
setCLongAtOffset(long byteOffset,
long value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setCLong(long) over this method. |
Pointer<T> |
setCLongs(CLong[] values)
Write an array of CLong values to the pointed memory location
|
Pointer<T> |
setCLongs(int[] values)
Write an array of CLong values to the pointed memory location
|
Pointer<T> |
setCLongs(long[] values)
Write an array of CLong values to the pointed memory location
|
Pointer<T> |
setCLongsAtOffset(long byteOffset,
CLong... values)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setCLongs(CLong...) over this method. |
abstract Pointer<T> |
setCLongsAtOffset(long byteOffset,
int[] values)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setCLongs(int[]) over this method. |
Pointer<T> |
setCLongsAtOffset(long byteOffset,
long[] values)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setCLongs(long[]) over this method. |
abstract Pointer<T> |
setCLongsAtOffset(long byteOffset,
long[] values,
int valuesOffset,
int length)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setCLongs(long[]) over this method. |
Pointer<T> |
setCString(String s)
Write a C string using the default charset to the pointed memory location (see
Pointer.StringType.C ). |
Pointer<T> |
setCStringAtOffset(long byteOffset,
String s)
Write a C string using the default charset to the pointed memory location shifted by a byte offset (see
Pointer.StringType.C ). |
abstract Pointer<T> |
setDouble(double value)
Write a double value to the pointed memory location
|
Pointer<T> |
setDoubleAtIndex(long valueIndex,
double value)
Write the nth contiguous double value to the pointed memory location.
|
abstract Pointer<T> |
setDoubleAtOffset(long byteOffset,
double value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setDouble(double) over this method. |
Pointer<T> |
setDoubles(double[] values)
Write an array of double values of the specified length to the pointed memory location
|
Pointer<T> |
setDoubles(DoubleBuffer values)
Write a buffer of double values of the specified length to the pointed memory location
|
Pointer<T> |
setDoublesAtOffset(long byteOffset,
double[] values)
Write an array of double values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setDoublesAtOffset(long byteOffset,
double[] values,
int valuesOffset,
int length)
Write an array of double values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given array offset and for the given length from the provided array.
|
Pointer<T> |
setDoublesAtOffset(long byteOffset,
DoubleBuffer values)
Write a buffer of double values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setDoublesAtOffset(long byteOffset,
DoubleBuffer values,
long valuesOffset,
long length)
Write a buffer of double values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given buffer offset and for the given length from the provided buffer.
|
abstract Pointer<T> |
setFloat(float value)
Write a float value to the pointed memory location
|
Pointer<T> |
setFloatAtIndex(long valueIndex,
float value)
Write the nth contiguous float value to the pointed memory location.
|
abstract Pointer<T> |
setFloatAtOffset(long byteOffset,
float value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setFloat(float) over this method. |
Pointer<T> |
setFloats(float[] values)
Write an array of float values of the specified length to the pointed memory location
|
Pointer<T> |
setFloats(FloatBuffer values)
Write a buffer of float values of the specified length to the pointed memory location
|
Pointer<T> |
setFloatsAtOffset(long byteOffset,
float[] values)
Write an array of float values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setFloatsAtOffset(long byteOffset,
float[] values,
int valuesOffset,
int length)
Write an array of float values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given array offset and for the given length from the provided array.
|
Pointer<T> |
setFloatsAtOffset(long byteOffset,
FloatBuffer values)
Write a buffer of float values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setFloatsAtOffset(long byteOffset,
FloatBuffer values,
long valuesOffset,
long length)
Write a buffer of float values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given buffer offset and for the given length from the provided buffer.
|
abstract Pointer<T> |
setInt(int value)
Write a int value to the pointed memory location
|
Pointer<T> |
setIntAtIndex(long valueIndex,
int value)
Write the nth contiguous int value to the pointed memory location.
|
abstract Pointer<T> |
setIntAtOffset(long byteOffset,
int value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setInt(int) over this method. |
Pointer<T> |
setIntegralAtOffset(long byteOffset,
org.bridj.AbstractIntegral value) |
Pointer<T> |
setInts(int[] values)
Write an array of int values of the specified length to the pointed memory location
|
Pointer<T> |
setInts(IntBuffer values)
Write a buffer of int values of the specified length to the pointed memory location
|
Pointer<T> |
setIntsAtOffset(long byteOffset,
int[] values)
Write an array of int values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setIntsAtOffset(long byteOffset,
int[] values,
int valuesOffset,
int length)
Write an array of int values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given array offset and for the given length from the provided array.
|
Pointer<T> |
setIntsAtOffset(long byteOffset,
IntBuffer values)
Write a buffer of int values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setIntsAtOffset(long byteOffset,
IntBuffer values,
long valuesOffset,
long length)
Write a buffer of int values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given buffer offset and for the given length from the provided buffer.
|
abstract Pointer<T> |
setLong(long value)
Write a long value to the pointed memory location
|
Pointer<T> |
setLongAtIndex(long valueIndex,
long value)
Write the nth contiguous long value to the pointed memory location.
|
abstract Pointer<T> |
setLongAtOffset(long byteOffset,
long value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setLong(long) over this method. |
Pointer<T> |
setLongs(long[] values)
Write an array of long values of the specified length to the pointed memory location
|
Pointer<T> |
setLongs(LongBuffer values)
Write a buffer of long values of the specified length to the pointed memory location
|
Pointer<T> |
setLongsAtOffset(long byteOffset,
long[] values)
Write an array of long values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setLongsAtOffset(long byteOffset,
long[] values,
int valuesOffset,
int length)
Write an array of long values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given array offset and for the given length from the provided array.
|
Pointer<T> |
setLongsAtOffset(long byteOffset,
LongBuffer values)
Write a buffer of long values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setLongsAtOffset(long byteOffset,
LongBuffer values,
long valuesOffset,
long length)
Write a buffer of long values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given buffer offset and for the given length from the provided buffer.
|
<O extends NativeObject> |
setNativeObject(O value,
Type type)
Write a native object value to the pointed memory location
|
Pointer<T> |
setPointer(Pointer<?> value)
Write a pointer value to the pointed memory location
|
Pointer<T> |
setPointerAtIndex(long valueIndex,
Pointer<?> value)
Write the nth contiguous pointer value to the pointed memory location.
|
Pointer<T> |
setPointerAtOffset(long byteOffset,
Pointer<?> value)
Write a pointer value to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setPointers(Pointer<?>[] values)
Write an array of pointer values to the pointed memory location
|
Pointer<T> |
setPointersAtOffset(long byteOffset,
Pointer<?>[] values)
Write an array of pointer values to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setPointersAtOffset(long byteOffset,
Pointer<?>[] values,
int valuesOffset,
int length)
Write length pointer values from the given array (starting at the given value offset) to the pointed memory location shifted by a byte offset
|
abstract Pointer<T> |
setShort(short value)
Write a short value to the pointed memory location
|
Pointer<T> |
setShortAtIndex(long valueIndex,
short value)
Write the nth contiguous short value to the pointed memory location.
|
abstract Pointer<T> |
setShortAtOffset(long byteOffset,
short value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setShort(short) over this method. |
Pointer<T> |
setShorts(short[] values)
Write an array of short values of the specified length to the pointed memory location
|
Pointer<T> |
setShorts(ShortBuffer values)
Write a buffer of short values of the specified length to the pointed memory location
|
Pointer<T> |
setShortsAtOffset(long byteOffset,
short[] values)
Write an array of short values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setShortsAtOffset(long byteOffset,
short[] values,
int valuesOffset,
int length)
Write an array of short values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given array offset and for the given length from the provided array.
|
Pointer<T> |
setShortsAtOffset(long byteOffset,
ShortBuffer values)
Write a buffer of short values of the specified length to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setShortsAtOffset(long byteOffset,
ShortBuffer values,
long valuesOffset,
long length)
Write a buffer of short values of the specified length to the pointed memory location shifted by a byte offset, reading values at the given buffer offset and for the given length from the provided buffer.
|
Pointer<T> |
setSizeT(long value)
Write a SizeT value to the pointed memory location
|
Pointer<T> |
setSizeT(SizeT value)
Write a SizeT value to the pointed memory location
|
Pointer<T> |
setSizeTAtIndex(long valueIndex,
long value)
Write the nth contiguous SizeT value to the pointed memory location.
|
Pointer<T> |
setSizeTAtOffset(long byteOffset,
long value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setSizeT(long) over this method. |
Pointer<T> |
setSizeTAtOffset(long byteOffset,
SizeT value)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setSizeT(SizeT) over this method. |
Pointer<T> |
setSizeTs(int[] values)
Write an array of SizeT values to the pointed memory location
|
Pointer<T> |
setSizeTs(long[] values)
Write an array of SizeT values to the pointed memory location
|
Pointer<T> |
setSizeTs(SizeT[] values)
Write an array of SizeT values to the pointed memory location
|
abstract Pointer<T> |
setSizeTsAtOffset(long byteOffset,
int[] values)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setSizeTs(int[]) over this method. |
Pointer<T> |
setSizeTsAtOffset(long byteOffset,
long[] values)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setSizeTs(long[]) over this method. |
abstract Pointer<T> |
setSizeTsAtOffset(long byteOffset,
long[] values,
int valuesOffset,
int length)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setSizeTs(long[]) over this method. |
Pointer<T> |
setSizeTsAtOffset(long byteOffset,
SizeT... values)
Deprecated.
Avoid using the byte offset methods variants unless you know what you're doing (may cause alignment issues). Please favour
setSizeTs(SizeT...) over this method. |
Pointer<T> |
setString(String s,
Pointer.StringType type)
Write a native string to the pointed memory location using the default charset.
|
Pointer<T> |
setStringAtOffset(long byteOffset,
String s,
Pointer.StringType type,
Charset charset)
Write a native string to the pointed memory location shifted by a byte offset, using the provided charset or the system's default if not provided.
|
Pointer<T> |
setValues(Buffer values)
Copy values from an NIO buffer to the pointed memory location
|
Pointer<T> |
setValuesAtOffset(long byteOffset,
Buffer values)
Copy all values from an NIO buffer to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setValuesAtOffset(long byteOffset,
Buffer values,
int valuesOffset,
int length)
Copy length values from an NIO buffer (beginning at element at valuesOffset index) to the pointed memory location shifted by a byte offset
|
Pointer<T> |
setWideCString(String s)
Write a WideC string using the default charset to the pointed memory location (see
Pointer.StringType.WideC ). |
Pointer<T> |
setWideCStringAtOffset(long byteOffset,
String s)
Write a WideC string using the default charset to the pointed memory location shifted by a byte offset (see
Pointer.StringType.WideC ). |
T[] |
toArray()
Create an array with all the values in the bounded memory area.
|
<U> U[] |
toArray(U[] array)
Create an array with all the values in the bounded memory area, reusing the provided array if its type is compatible and its size is big enough.
|
String |
toString() |
void |
update(long index,
T element)
Alias for
set(long, Object) defined for more natural use from the Scala language. |
void |
updateBuffer(Buffer buffer)
When a pointer was created with
pointerToBuffer(Buffer) on a non-direct buffer, a native copy of the buffer data was made. |
Pointer<T> |
validBytes(long byteCount)
Creates a pointer that has the given number of valid bytes ahead.
|
Pointer<T> |
validElements(long elementCount)
Creates a pointer that has the given number of valid elements ahead.
|
Pointer<T> |
withoutValidityInformation()
Deprecated.
Pointers obtained via this method are faster but unsafe and are likely to cause crashes hard to debug if your logic is wrong.
|
Pointer<T> |
withReleaser(Pointer.Releaser beforeDeallocation)
Deprecated.
This method can easily be misused and is reserved to advanced users.
|
forEach, spliterator
public static final int SIZE
public static final int defaultAlignment
public static Type pointerType(Type targetType)
Pointer<T>
type. Pointer.pointerType(Integer.class)
returns a type that represents Pointer<Integer>
public static <E extends Enum<E>> Type intEnumType(Class<? extends IntValuedEnum<E>> targetType)
IntValuedEnum<T>
type. Pointer.intEnumType(SomeEnum.class)
returns a type that represents IntValuedEnum<SomeEnum>
public void release()
offset(long)
or next(long)
, for instance), this method tries to release the original pointer.RuntimeException
- if the pointer was already releasedpublic int compareTo(Pointer<?> p)
compareTo
in interface Comparable<Pointer<?>>
p
- other pointerpublic int compareBytes(Pointer<?> other, long byteCount)
public int compareBytesAtOffset(long byteOffset, Pointer<?> other, long otherByteOffset, long byteCount)
public int hashCode()
public Pointer<T> offset(long byteOffset)
byteOffset
- offset in bytes of the new pointer vs. this pointer. The expression p.offset(byteOffset).getPeer() - p.getPeer() == byteOffset
is always true.public Pointer<T> validBytes(long byteCount)
@Deprecated public Pointer<T> withoutValidityInformation()
public Pointer<T> clone()
getValidBytes()
, validBytes(long)
or validElements(long)
).public Pointer<T> validElements(long elementCount)
public Pointer<Pointer<T>> getReference()
int** pp = ...;
int* p = pp[10];
int** ref = &p;
ASSERT(pp == ref);
Here is its equivalent Java code :
Pointer<Pointer<Integer>> pp = ...;
Pointer<Integer> p = pp.get(10);
Pointer<Pointer<Integer>> ref = p.getReference();
assert pp.equals(ref);
public final long getPeer()
(size_t)&pointer
public static <R> Pointer<DynamicFunction<R>> allocateDynamicCallback(DynamicCallback<R> callback, Convention.Style callingConvention, Type returnType, Type... parameterTypes)
DynamicCallback
handler.double (*)(float, int)
that adds its two arguments can be created with :Pointer callback = Pointer.allocateDynamicCallback(
new DynamicCallback<Integer>() {
public Double apply(Object... args) {
float a = (Float)args[0];
int b = (Integer)args[1];
return (double)(a + b);
}
},
null, // Use the platform's default calling convention
int.class, // return type
float.class, double.class // parameter types
);
void
return type, you can use Void
:Pointer callback = Pointer.allocateDynamicCallback(
new DynamicCallback<Void>() {
public Void apply(Object... args) {
...
return null; // Void cannot be instantiated anyway ;-)
}
},
null, // Use the platform's default calling convention
int.class, // return type
float.class, double.class // parameter types
);
public <U> Pointer<U> as(PointerIO<U> newIO)
newIO
- public Pointer<T> order(ByteOrder order)
order
- byte order (endianness) of the returned pointerpublic final PointerIO<T> getIO()
public abstract boolean isOrdered()
order()
, order(ByteOrder)
public <U> Pointer<U> as(Type type)
as(Class)
T* pointerT = ...;
U* pointerU = (U*)pointerT;
Pointer<T> pointerT = ...;
Pointer<U> pointerU = pointerT.as(U.class);
U
- type of the elements pointed by the returned pointertype
- type of the elements pointed by the returned pointerpublic <U> Pointer<U> as(Class<U> type)
as(Type)
T* pointerT = ...;
U* pointerU = (U*)pointerT;
Pointer<T> pointerT = ...;
Pointer<U> pointerU = pointerT.as(U.class); // or pointerT.as(U.class);
U
- type of the elements pointed by the returned pointertype
- type of the elements pointed by the returned pointerpublic <R> DynamicFunction<R> asDynamicFunction(Convention.Style callingConvention, Type returnType, Type... parameterTypes)
double (*ptr)(int, const char*) = someAddress;
double result = ptr(10, "hello");
Its Java equivalent with BridJ is the following :
DynamicFunction ptr = someAddress.asDynamicFunction(null, double.class, int.class, Pointer.class);
double result = (Double)ptr.apply(10, pointerToCString("hello"));
Also see CRuntime.getDynamicFunctionFactory(org.bridj.NativeLibrary, org.bridj.ann.Convention.Style, java.lang.reflect.Type, java.lang.reflect.Type[])
for more options.callingConvention
- calling convention used by the function (if null, default is typically Convention.Style.CDecl
)returnType
- return type of the functionparameterTypes
- parameter types of the functionpublic Pointer<?> asUntyped()
ptr.as((Class<?>)null)
.as(Class)
T* pointerT = ...;
void* pointer = (void*)pointerT;
Pointer<T> pointerT = ...;
Pointer<?> pointer = pointerT.asUntyped(); // or pointerT.as((Class<?>)null);
public long getValidBytes()
allocateBytes(long)
, for instance), created out of another pointer which memory validity information is available (with offset(long)
, next()
, next(long)
) or created from a direct NIO buffer (pointerToBuffer(Buffer)
, pointerToInts(IntBuffer)
...)public long getValidElements()
getTargetType()
) or -1 if it is unknown.allocateBytes(long)
, for instance), created out of another pointer which memory validity information is available (with offset(long)
, next()
, next(long)
) or created from a direct NIO buffer (pointerToBuffer(Buffer)
, pointerToInts(IntBuffer)
...)public ListIterator<T> iterator()
public static <E extends Enum<E>> Pointer<IntValuedEnum<E>> pointerToEnum(IntValuedEnum<E> instance)
@Deprecated public static <N extends NativeObject> Pointer<N> pointerTo(N instance)
getPointer(NativeObject)
instead.public static <N extends NativeObject> Pointer<N> getPointer(N instance)
public static <N extends NativeObjectInterface> Pointer<N> getPointer(N instance)
public static <R extends NativeObject> Pointer<R> getPointer(NativeObject instance, Type targetType)
public static long getAddress(NativeObject instance, Class targetType)
getPointer(instance, targetType).getPeer()
, see getPointer(NativeObject, Type)
).public <O extends NativeObject> O getNativeObjectAtOffset(long byteOffset, Type type)
getNativeObject(Type)
over this method.public <O extends NativeObject> Pointer<T> setNativeObject(O value, Type type)
public <O extends NativeObject> O getNativeObjectAtOffset(long byteOffset, Class<O> type)
getNativeObject(Class)
over this method.public <O extends NativeObject> O getNativeObject(Class<O> type)
public <O extends NativeObject> O getNativeObject(Type type)
public boolean isAligned()
RuntimeException
- If the target type of this pointer is unknownpublic boolean isAligned(long alignment)
public T get()
int* array = new int[10];
for (int index = 0; index < 10; index++, array++)
printf("%i\n", *array);
Here is its equivalent in Java :
import static org.bridj.Pointer.*;
...
Pointer<Integer> array = allocateInts(10);
for (int index = 0; index < 10; index++) {
System.out.println("%i\n".format(array.get()));
array = array.next();
}
Here is a simpler equivalent in Java :
import static org.bridj.Pointer.*;
...
Pointer<Integer> array = allocateInts(10);
for (int value : array) // array knows its size, so we can iterate on it
System.out.println("%i\n".format(value));
RuntimeException
- if called on an untyped Pointer<?>
instance (see getTargetType()
)public static <T> T get(Pointer<T> pointer)
public T get(long index)
int* array = new int[10];
int index = 5;
int value = array[index];
Here is its equivalent in Java :
import static org.bridj.Pointer.*;
...
Pointer<Integer> array = allocateInts(10);
int index = 5;
int value = array.get(index);
index
- offset in pointed elements at which the value should be copied. Can be negative if the pointer was offset and the memory before it is valid.RuntimeException
- if called on an untyped Pointer<?>
instance (getTargetType()
)public T set(T value)
List.set(int, Object)
which returns the old value of that element !!!).
int* array = new int[10];
for (int index = 0; index < 10; index++, array++) {
int value = index;
array = value;
}
Here is its equivalent in Java :
import static org.bridj.Pointer.*;
...
Pointer<Integer> array = allocateInts(10);
for (int index = 0; index < 10; index++) {
int value = index;
array.set(value);
array = array.next();
}
List.set(int, Object)
!!!)RuntimeException
- if called on a raw and untyped Pointer
instance (see asUntyped()
and getTargetType()
)public T set(long index, T value)
List.set(int, Object)
which returns the old value of that element !!!).
float* array = new float[10];
int index = 5;
float value = 12;
array[index] = value;
Here is its equivalent in Java :
import static org.bridj.Pointer.*;
...
Pointer<Float> array = allocateFloats(10);
int index = 5;
float value = 12;
array.set(index, value);
index
- offset in pointed elements at which the value should be copied. Can be negative if the pointer was offset and the memory before it is valid.value
- value to set at pointed memory locationList.set(int, Object)
!!!)RuntimeException
- if called on a raw and untyped Pointer
instance (see asUntyped()
and getTargetType()
)public static long getPeer(Pointer<?> pointer)
getPeer()
), or zero if the pointer is null.public long getTargetSize()
RuntimeException
- if the target type is unknown (see getTargetType()
)public Pointer<T> next()
public Pointer<T> next(long delta)
public static void release(Pointer... pointers)
release()
).@Deprecated public static Pointer<?> pointerToAddress(long peer)
peer
- native memory address that is to be converted to a pointerpointer.getPeer() == address
@Deprecated public static Pointer<?> pointerToAddress(long peer, long size)
size
- number of bytes known to be readable at the pointed addresspeer
- native memory address that is to be converted to a pointerpointer.getPeer() == peer
public static <P> Pointer<P> pointerToAddress(long peer, Class<P> targetClass, Pointer.Releaser releaser)
targetClass
- type of the elements pointed by the resulting pointerreleaser
- object responsible for reclaiming the native memory once whenever the returned pointer is garbage-collectedpeer
- native memory address that is to be converted to a pointerpointer.getPeer() == peer
public static <P> Pointer<P> pointerToAddress(long peer, Type targetType, Pointer.Releaser releaser)
targetType
- type of the elements pointed by the resulting pointerreleaser
- object responsible for reclaiming the native memory once whenever the returned pointer is garbage-collectedpeer
- native memory address that is to be converted to a pointerpointer.getPeer() == peer
public static <P> Pointer<P> pointerToAddress(long peer, PointerIO<P> io)
io
- PointerIO instance that knows how to read the elements pointed by the resulting pointerpeer
- native memory address that is to be converted to a pointerpointer.getPeer() == peer
@Deprecated public static Pointer<?> pointerToAddress(long peer, Pointer.Releaser releaser)
releaser
- object responsible for reclaiming the native memory once whenever the returned pointer is garbage-collectedpeer
- native memory address that is to be converted to a pointerpointer.getPeer() == peer
public static Pointer<?> pointerToAddress(long peer, long size, Pointer.Releaser releaser)
releaser
- object responsible for reclaiming the native memory once whenever the returned pointer is garbage-collectedsize
- number of bytes known to be readable at the pointed addresspeer
- native memory address that is to be converted to a pointerpointer.getPeer() == peer
public static <P> Pointer<P> pointerToAddress(long peer, long size, PointerIO<P> io, Pointer.Releaser releaser)
io
- PointerIO instance that knows how to read the elements pointed by the resulting pointerreleaser
- object responsible for reclaiming the native memory once whenever the returned pointer is garbage-collectedsize
- number of bytes known to be readable at the pointed addresspeer
- native memory address that is to be converted to a pointerpointer.getPeer() == peer
@Deprecated public static <P> Pointer<P> pointerToAddress(long peer, Class<P> targetClass)
targetClass
- type of the elements pointed by the resulting pointerpeer
- native memory address that is to be converted to a pointerpointer.getPeer() == peer
@Deprecated public static <P> Pointer<P> pointerToAddress(long peer, Type targetType)
targetType
- type of the elements pointed by the resulting pointerpeer
- native memory address that is to be converted to a pointerpointer.getPeer() == peer
public static <P extends TypedPointer> Pointer<P> allocateTypedPointer(Class<P> type)
release()
.public static <P extends TypedPointer> Pointer<P> allocateTypedPointers(Class<P> type, long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<P extends TypedPointer>
instance that can be safely iterated upon.public static <P> Pointer<Pointer<P>> allocatePointer(Class<P> targetType)
targetType
- target type of the pointer values to be stored in the allocated memorypublic static <P> Pointer<Pointer<P>> allocatePointer(Type targetType)
targetType
- target type of the pointer values to be stored in the allocated memorypublic static <P> Pointer<Pointer<Pointer<P>>> allocatePointerPointer(Type targetType)
targetType
- target type of the values pointed by the pointer values to be stored in the allocated memorypublic static <P> Pointer<Pointer<Pointer<P>>> allocatePointerPointer(Class<P> targetType)
targetType
- target type of the values pointed by the pointer values to be stored in the allocated memorypublic static <V> Pointer<Pointer<?>> allocatePointer()
public static Pointer<Pointer<?>> allocatePointers(int arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<Pointer<?>>
instance that can be safely iterated upon.public static <P> Pointer<Pointer<P>> allocatePointers(Class<P> targetType, int arrayLength)
targetType
- target type of element pointers in the resulting pointer array.arrayLength
- size of the allocated array, in elementspublic static <P> Pointer<Pointer<P>> allocatePointers(Type targetType, int arrayLength)
targetType
- target type of element pointers in the resulting pointer array.arrayLength
- size of the allocated array, in elementspublic static <V> Pointer<V> allocate(Class<V> elementClass)
elementClass
- type of the array elementspublic static <V> Pointer<V> allocate(Type elementClass)
elementClass
- type of the array elementspublic static <V> Pointer<V> allocate(PointerIO<V> io)
PointerIO.getTargetType()
)io
- PointerIO instance able to store and retrieve the elementPointerIO.getTargetType()
)public static <V> Pointer<V> allocateArray(PointerIO<V> io, long arrayLength)
PointerIO.getTargetType()
)io
- PointerIO instance able to store and retrieve elements of the arrayarrayLength
- length of the array in elementsPointerIO.getTargetType()
)public static <V> Pointer<V> allocateArray(PointerIO<V> io, long arrayLength, Pointer.Releaser beforeDeallocation)
PointerIO.getTargetType()
)io
- PointerIO instance able to store and retrieve elements of the arrayarrayLength
- length of the array in elementsbeforeDeallocation
- fake releaser that should be run just before the memory is actually released, for instance in order to call some object destructorPointerIO.getTargetType()
)public static <V> Pointer<V> allocateBytes(PointerIO<V> io, long byteSize, Pointer.Releaser beforeDeallocation)
PointerIO.getTargetType()
)io
- PointerIO instance able to store and retrieve elements of the arraybyteSize
- length of the array in bytesbeforeDeallocation
- fake releaser that should be run just before the memory is actually released, for instance in order to call some object destructorpublic static <V> Pointer<V> allocateAlignedBytes(PointerIO<V> io, long byteSize, int alignment, Pointer.Releaser beforeDeallocation)
PointerIO.getTargetType()
), ensuring the pointer to the memory is aligned to the provided boundary.io
- PointerIO instance able to store and retrieve elements of the arraybyteSize
- length of the array in bytesalignment
- boundary to which the returned pointer should be alignedbeforeDeallocation
- fake releaser that should be run just before the memory is actually released, for instance in order to call some object destructor@Deprecated public Pointer<T> withReleaser(Pointer.Releaser beforeDeallocation)
beforeDeallocation
- releaser that should be run before this pointer's releaser (if any).public static <V> Pointer<V> allocateArray(Class<V> elementClass, long arrayLength)
elementClass
- type of the array elementsarrayLength
- length of the array in elementspublic static <V> Pointer<V> allocateArray(Type elementClass, long arrayLength)
elementClass
- type of the array elementsarrayLength
- length of the array in elementspublic static <V> Pointer<V> allocateAlignedArray(Class<V> elementClass, long arrayLength, int alignment)
elementClass
- type of the array elementsarrayLength
- length of the array in elementsalignment
- boundary to which the returned pointer should be alignedpublic static <V> Pointer<V> allocateAlignedArray(Type elementClass, long arrayLength, int alignment)
elementClass
- type of the array elementsarrayLength
- length of the array in elementsalignment
- boundary to which the returned pointer should be alignedpublic static Pointer<?> pointerToBuffer(Buffer buffer)
pointerToArray(Object)
), unless a call to updateBuffer(Buffer)
is made manually.offset(long)
or next(long)
) can be used safely : it retains a reference to the original NIO buffer, so that this latter cannot be garbage collected before the pointer.public void updateBuffer(Buffer buffer)
pointerToBuffer(Buffer)
on a non-direct buffer, a native copy of the buffer data was made.
This method updates the original buffer with the native memory, and does nothing if the buffer is direct and points to the same memory location as this pointer.IllegalArgumentException
- if buffer is direct and does not point to the exact same location as this Pointer instancepublic static Pointer<Integer> pointerToInt(int value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<Integer> pointerToInts(int... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<Integer>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<Pointer<Integer>> pointerToInts(int[][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Pointer<Pointer<Integer>>> pointerToInts(int[][][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Integer> allocateInt()
release()
.public static Pointer<Integer> allocateInts(long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<Integer>
instance that can be safely iterated upon.public static Pointer<Pointer<Integer>> allocateInts(long dim1, long dim2)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Pointer<Pointer<Integer>>> allocateInts(long dim1, long dim2, long dim3)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Long> pointerToLong(long value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<Long> pointerToLongs(long... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<Long>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<Pointer<Long>> pointerToLongs(long[][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Pointer<Pointer<Long>>> pointerToLongs(long[][][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Long> allocateLong()
release()
.public static Pointer<Long> allocateLongs(long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<Long>
instance that can be safely iterated upon.public static Pointer<Pointer<Long>> allocateLongs(long dim1, long dim2)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Pointer<Pointer<Long>>> allocateLongs(long dim1, long dim2, long dim3)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Short> pointerToShort(short value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<Short> pointerToShorts(short... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<Short>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<Pointer<Short>> pointerToShorts(short[][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Pointer<Pointer<Short>>> pointerToShorts(short[][][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Short> allocateShort()
release()
.public static Pointer<Short> allocateShorts(long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<Short>
instance that can be safely iterated upon.public static Pointer<Pointer<Short>> allocateShorts(long dim1, long dim2)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Pointer<Pointer<Short>>> allocateShorts(long dim1, long dim2, long dim3)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Byte> pointerToByte(byte value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<Byte> pointerToBytes(byte... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<Byte>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<Pointer<Byte>> pointerToBytes(byte[][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Pointer<Pointer<Byte>>> pointerToBytes(byte[][][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Byte> allocateByte()
release()
.public static Pointer<Byte> allocateBytes(long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<Byte>
instance that can be safely iterated upon.public static Pointer<Pointer<Byte>> allocateBytes(long dim1, long dim2)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Pointer<Pointer<Byte>>> allocateBytes(long dim1, long dim2, long dim3)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Character> pointerToChar(char value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<Character> pointerToChars(char... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<Character>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<Pointer<Character>> pointerToChars(char[][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Pointer<Pointer<Character>>> pointerToChars(char[][][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Character> allocateChar()
release()
.public static Pointer<Character> allocateChars(long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<Character>
instance that can be safely iterated upon.public static Pointer<Pointer<Character>> allocateChars(long dim1, long dim2)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Pointer<Pointer<Character>>> allocateChars(long dim1, long dim2, long dim3)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Float> pointerToFloat(float value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<Float> pointerToFloats(float... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<Float>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<Pointer<Float>> pointerToFloats(float[][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Pointer<Pointer<Float>>> pointerToFloats(float[][][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Float> allocateFloat()
release()
.public static Pointer<Float> allocateFloats(long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<Float>
instance that can be safely iterated upon.public static Pointer<Pointer<Float>> allocateFloats(long dim1, long dim2)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Pointer<Pointer<Float>>> allocateFloats(long dim1, long dim2, long dim3)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Double> pointerToDouble(double value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<Double> pointerToDoubles(double... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<Double>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<Pointer<Double>> pointerToDoubles(double[][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Pointer<Pointer<Double>>> pointerToDoubles(double[][][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Double> allocateDouble()
release()
.public static Pointer<Double> allocateDoubles(long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<Double>
instance that can be safely iterated upon.public static Pointer<Pointer<Double>> allocateDoubles(long dim1, long dim2)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Pointer<Pointer<Double>>> allocateDoubles(long dim1, long dim2, long dim3)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Boolean> pointerToBoolean(boolean value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<Boolean> pointerToBooleans(boolean... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<Boolean>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<Pointer<Boolean>> pointerToBooleans(boolean[][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Pointer<Pointer<Boolean>>> pointerToBooleans(boolean[][][] values)
release()
.offset(long)
, next(long)
, next()
).values
- initial values for the created memory locationpublic static Pointer<Boolean> allocateBoolean()
release()
.public static Pointer<Boolean> allocateBooleans(long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<Boolean>
instance that can be safely iterated upon.public static Pointer<Pointer<Boolean>> allocateBooleans(long dim1, long dim2)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Pointer<Pointer<Boolean>>> allocateBooleans(long dim1, long dim2, long dim3)
release()
.offset(long)
, next(long)
, next()
).public static Pointer<Integer> pointerToInts(IntBuffer buffer)
pointerToInts(int[])
), unless a call to updateBuffer(Buffer)
is made manually.offset(long)
or next(long)
) can be used safely : it retains a reference to the original NIO buffer, so that this latter cannot be garbage collected before the pointer.public static Pointer<Long> pointerToLongs(LongBuffer buffer)
pointerToLongs(long[])
), unless a call to updateBuffer(Buffer)
is made manually.offset(long)
or next(long)
) can be used safely : it retains a reference to the original NIO buffer, so that this latter cannot be garbage collected before the pointer.public static Pointer<Short> pointerToShorts(ShortBuffer buffer)
pointerToShorts(short[])
), unless a call to updateBuffer(Buffer)
is made manually.offset(long)
or next(long)
) can be used safely : it retains a reference to the original NIO buffer, so that this latter cannot be garbage collected before the pointer.public static Pointer<Byte> pointerToBytes(ByteBuffer buffer)
pointerToBytes(byte[])
), unless a call to updateBuffer(Buffer)
is made manually.offset(long)
or next(long)
) can be used safely : it retains a reference to the original NIO buffer, so that this latter cannot be garbage collected before the pointer.public static Pointer<Character> pointerToChars(CharBuffer buffer)
pointerToChars(char[])
), unless a call to updateBuffer(Buffer)
is made manually.offset(long)
or next(long)
) can be used safely : it retains a reference to the original NIO buffer, so that this latter cannot be garbage collected before the pointer.public static Pointer<Float> pointerToFloats(FloatBuffer buffer)
pointerToFloats(float[])
), unless a call to updateBuffer(Buffer)
is made manually.offset(long)
or next(long)
) can be used safely : it retains a reference to the original NIO buffer, so that this latter cannot be garbage collected before the pointer.public static Pointer<Double> pointerToDoubles(DoubleBuffer buffer)
pointerToDoubles(double[])
), unless a call to updateBuffer(Buffer)
is made manually.offset(long)
or next(long)
) can be used safely : it retains a reference to the original NIO buffer, so that this latter cannot be garbage collected before the pointer.public Type getTargetType()
@Deprecated public Pointer<?> getPointer()
public Pointer<?> getPointerAtOffset(long byteOffset)
public Pointer<?> getPointerAtIndex(long valueIndex)
getPointerAtOffset(valueIndex * Pointer.SIZE)
.valueIndex
- index of the value to readpublic <U> Pointer<U> getPointer(Class<U> c)
c
- class of the elements pointed by the resulting pointerpublic <U> Pointer<U> getPointer(PointerIO<U> pio)
pio
- PointerIO instance that knows how to read the elements pointed by the resulting pointerpublic <U> Pointer<U> getPointerAtOffset(long byteOffset, Class<U> c)
c
- class of the elements pointed by the resulting pointerpublic <U> Pointer<U> getPointerAtOffset(long byteOffset, Type t)
t
- type of the elements pointed by the resulting pointerpublic <U> Pointer<U> getPointerAtOffset(long byteOffset, PointerIO<U> pio)
pio
- PointerIO instance that knows how to read the elements pointed by the resulting pointerpublic Pointer<T> setPointer(Pointer<?> value)
public Pointer<T> setPointerAtOffset(long byteOffset, Pointer<?> value)
public Pointer<T> setPointerAtIndex(long valueIndex, Pointer<?> value)
setPointerAtOffset(valueIndex * Pointer.SIZE, value)
.valueIndex
- index of the value to writevalue
- pointer value to writepublic Pointer<?>[] getPointersAtOffset(long byteOffset, int arrayLength)
getPointersAtOffset(long, int, Type)
, getPointersAtOffset(long, int, Class)
or getPointersAtOffset(long, int, PointerIO)
@Deprecated public Pointer<?>[] getPointers()
getPointersAtOffset(long, int, Type)
, getPointersAtOffset(long, int, Class)
or getPointersAtOffset(long, int, PointerIO)
@Deprecated public Pointer<?>[] getPointers(int arrayLength)
getPointersAtOffset(long, int, Type)
, getPointersAtOffset(long, int, Class)
or getPointersAtOffset(long, int, PointerIO)
public <U> Pointer<U>[] getPointersAtOffset(long byteOffset, int arrayLength, Type t)
t
- type of the elements pointed by the resulting pointerpublic <U> Pointer<U>[] getPointersAtOffset(long byteOffset, int arrayLength, Class<U> t)
t
- class of the elements pointed by the resulting pointerpublic <U> Pointer<U>[] getPointersAtOffset(long byteOffset, int arrayLength, PointerIO pio)
pio
- PointerIO instance that knows how to read the elements pointed by the resulting pointerpublic Pointer<T> setPointersAtOffset(long byteOffset, Pointer<?>[] values)
public Pointer<T> setPointersAtOffset(long byteOffset, Pointer<?>[] values, int valuesOffset, int length)
public Pointer<T> setPointers(Pointer<?>[] values)
public Object getArrayAtOffset(long byteOffset, int length)
Pointer<Integer>
), this method returns primitive arrays (e.g. int[]
), unlike toArray()
(which returns arrays of objects so primitives end up being boxed, e.g. Integer[]
)public Object getArray(int length)
Pointer<Integer>
), this method returns primitive arrays (e.g. int[]
), unlike toArray()
(which returns arrays of objects so primitives end up being boxed, e.g. Integer[]
)public Object getArray()
Pointer<Integer>
), this method returns primitive arrays (e.g. int[]
), unlike toArray()
(which returns arrays of objects so primitives end up being boxed, e.g. Integer[]
)public <B extends Buffer> B getBufferAtOffset(long byteOffset, int length)
Buffer
of elements from the pointed memory location shifted by a byte offset.Buffer
of values of the requested length.UnsupportedOperationException
- if this pointer's target type is not a Java primitive type with a corresponding NIO Buffer
class.public <B extends Buffer> B getBuffer(int length)
Buffer
of elements from the pointed memory location.Buffer
of values of the requested length.UnsupportedOperationException
- if this pointer's target type is not a Java primitive type with a corresponding NIO Buffer
class.public <B extends Buffer> B getBuffer()
Buffer
of remaining elements from the pointed memory location.UnsupportedOperationException
- if this pointer's target type is not a Java primitive type with a corresponding NIO Buffer
class.public Pointer<T> setArrayAtOffset(long byteOffset, Object array)
Pointer<Integer>
), this method accepts primitive arrays (e.g. int[]
) instead of arrays of boxed primitives (e.g. Integer[]
)public static <T> Pointer<T> pointerToArray(Object array)
release()
.offset(long)
, next(long)
, next()
).Pointer<Integer>
), this method accepts primitive arrays (e.g. int[]
) instead of arrays of boxed primitives (e.g. Integer[]
)array
- primitive array containing the initial values for the created memory areapublic Pointer<T> setArray(Object array)
Pointer<Integer>
), this method accepts primitive arrays (e.g. int[]
) instead of arrays of boxed primitives (e.g. Integer[]
)public static Pointer<SizeT> pointerToSizeT(long value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<SizeT> pointerToSizeT(SizeT value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<SizeT> pointerToSizeTs(long... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<SizeT>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<SizeT> pointerToSizeTs(SizeT... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<SizeT>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<SizeT> pointerToSizeTs(int[] values)
release()
.offset(long)
, next(long)
, next()
).Iterable<SizeT>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<SizeT> allocateSizeTs(long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<SizeT>
instance that can be safely iterated upon.public static Pointer<SizeT> allocateSizeT()
release()
.public long getSizeT()
public long getSizeTAtOffset(long byteOffset)
getSizeT()
over this method.public long getSizeTAtIndex(long valueIndex)
getSizeTAtOffset(valueIndex * SizeT.SIZE
.valueIndex
- index of the value to readpublic long[] getSizeTs()
public long[] getSizeTs(int arrayLength)
public long[] getSizeTsAtOffset(long byteOffset, int arrayLength)
getSizeTs(int)
over this method.public Pointer<T> setSizeTAtOffset(long byteOffset, long value)
setSizeT(long)
over this method.public Pointer<T> setSizeTAtIndex(long valueIndex, long value)
setSizeTAtOffset(valueIndex * SizeT.SIZE, value)
.valueIndex
- index of the value to writevalue
- SizeT value to writepublic Pointer<T> setSizeTAtOffset(long byteOffset, SizeT value)
setSizeT(SizeT)
over this method.public Pointer<T> setSizeTs(long[] values)
public Pointer<T> setSizeTs(int[] values)
public Pointer<T> setSizeTs(SizeT[] values)
public Pointer<T> setSizeTsAtOffset(long byteOffset, long[] values)
setSizeTs(long[])
over this method.public abstract Pointer<T> setSizeTsAtOffset(long byteOffset, long[] values, int valuesOffset, int length)
setSizeTs(long[])
over this method.public Pointer<T> setSizeTsAtOffset(long byteOffset, SizeT... values)
setSizeTs(SizeT...)
over this method.public abstract Pointer<T> setSizeTsAtOffset(long byteOffset, int[] values)
setSizeTs(int[])
over this method.public static Pointer<CLong> pointerToCLong(long value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<CLong> pointerToCLong(CLong value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static Pointer<CLong> pointerToCLongs(long... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<CLong>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<CLong> pointerToCLongs(CLong... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<CLong>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<CLong> pointerToCLongs(int[] values)
release()
.offset(long)
, next(long)
, next()
).Iterable<CLong>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic static Pointer<CLong> allocateCLongs(long arrayLength)
release()
.offset(long)
, next(long)
, next()
).Iterable<CLong>
instance that can be safely iterated upon.public static Pointer<CLong> allocateCLong()
release()
.public long getCLong()
public long getCLongAtOffset(long byteOffset)
getCLong()
over this method.public long getCLongAtIndex(long valueIndex)
getCLongAtOffset(valueIndex * CLong.SIZE
.valueIndex
- index of the value to readpublic long[] getCLongs()
public long[] getCLongs(int arrayLength)
public long[] getCLongsAtOffset(long byteOffset, int arrayLength)
getCLongs(int)
over this method.public Pointer<T> setCLongAtOffset(long byteOffset, long value)
setCLong(long)
over this method.public Pointer<T> setCLongAtIndex(long valueIndex, long value)
setCLongAtOffset(valueIndex * CLong.SIZE, value)
.valueIndex
- index of the value to writevalue
- CLong value to writepublic Pointer<T> setCLongAtOffset(long byteOffset, CLong value)
setCLong(CLong)
over this method.public Pointer<T> setCLongs(long[] values)
public Pointer<T> setCLongs(int[] values)
public Pointer<T> setCLongs(CLong[] values)
public Pointer<T> setCLongsAtOffset(long byteOffset, long[] values)
setCLongs(long[])
over this method.public abstract Pointer<T> setCLongsAtOffset(long byteOffset, long[] values, int valuesOffset, int length)
setCLongs(long[])
over this method.public Pointer<T> setCLongsAtOffset(long byteOffset, CLong... values)
setCLongs(CLong...)
over this method.public abstract Pointer<T> setCLongsAtOffset(long byteOffset, int[] values)
setCLongs(int[])
over this method.public static <T> Pointer<Pointer<T>> pointerToPointer(Pointer<T> value)
release()
.offset(long)
, next(long)
, next()
).value
- initial value for the created memory locationpublic static <T> Pointer<Pointer<T>> pointerToPointers(Pointer<T>... values)
release()
.offset(long)
, next(long)
, next()
).Iterable<Pointer>
instance that can be safely iterated upon :
for (float f : pointerToFloats(1f, 2f, 3.3f))
System.out.println(f);
values
- initial values for the created memory locationpublic Pointer<T> setValuesAtOffset(long byteOffset, Buffer values)
public Pointer<T> setValuesAtOffset(long byteOffset, Buffer values, int valuesOffset, int length)
public Pointer<T> setValues(Buffer values)
@Deprecated public Pointer<T> copyBytesAtOffsetTo(long byteOffset, Pointer<?> destination, long byteOffsetInDestination, long byteCount)
moveBytesAtOffsetTo(long, Pointer, long, long)
must be used instead.@Deprecated public Pointer<T> copyBytesTo(Pointer<?> destination, long byteCount)
moveBytesAtOffsetTo(long, Pointer, long, long)
must be used instead.copyBytesAtOffsetTo(long, Pointer, long, long)
for more options.@Deprecated public Pointer<T> moveBytesAtOffsetTo(long byteOffset, Pointer<?> destination, long byteOffsetInDestination, long byteCount)
public Pointer<T> moveBytesTo(Pointer<?> destination, long byteCount)
public Pointer<T> moveBytesTo(Pointer<?> destination)
public Pointer<T> copyTo(Pointer<?> destination)
copyBytesTo(Pointer, long)
, getValidBytes()
)public Pointer<T> copyTo(Pointer<?> destination, long elementCount)
copyBytesAtOffsetTo(long, Pointer, long, long)
, getValidBytes()
)public Pointer<T> find(Pointer<?> needle)
public Pointer<T> findLast(Pointer<?> needle)
find(Pointer)
).public abstract Pointer<T> setInt(int value)
public abstract Pointer<T> setIntAtOffset(long byteOffset, int value)
setInt(int)
over this method.public Pointer<T> setIntAtIndex(long valueIndex, int value)
setIntAtOffset(valueIndex * 4, value)
.valueIndex
- index of the value to writevalue
- int value to writepublic Pointer<T> setInts(int[] values)
public Pointer<T> setIntsAtOffset(long byteOffset, int[] values)
public Pointer<T> setIntsAtOffset(long byteOffset, int[] values, int valuesOffset, int length)
public abstract int getInt()
public abstract int getIntAtOffset(long byteOffset)
getInt()
over this method.public int getIntAtIndex(long valueIndex)
getIntAtOffset(valueIndex * 4)
.valueIndex
- index of the value to readpublic int[] getInts(int length)
public int[] getInts()
public int[] getIntsAtOffset(long byteOffset, int length)
getInts(int)
over this method.public abstract Pointer<T> setLong(long value)
public abstract Pointer<T> setLongAtOffset(long byteOffset, long value)
setLong(long)
over this method.public Pointer<T> setLongAtIndex(long valueIndex, long value)
setLongAtOffset(valueIndex * 8, value)
.valueIndex
- index of the value to writevalue
- long value to writepublic Pointer<T> setLongs(long[] values)
public Pointer<T> setLongsAtOffset(long byteOffset, long[] values)
public Pointer<T> setLongsAtOffset(long byteOffset, long[] values, int valuesOffset, int length)
public abstract long getLong()
public abstract long getLongAtOffset(long byteOffset)
getLong()
over this method.public long getLongAtIndex(long valueIndex)
getLongAtOffset(valueIndex * 8)
.valueIndex
- index of the value to readpublic long[] getLongs(int length)
public long[] getLongs()
public long[] getLongsAtOffset(long byteOffset, int length)
getLongs(int)
over this method.public abstract Pointer<T> setShort(short value)
public abstract Pointer<T> setShortAtOffset(long byteOffset, short value)
setShort(short)
over this method.public Pointer<T> setShortAtIndex(long valueIndex, short value)
setShortAtOffset(valueIndex * 2, value)
.valueIndex
- index of the value to writevalue
- short value to writepublic Pointer<T> setShorts(short[] values)
public Pointer<T> setShortsAtOffset(long byteOffset, short[] values)
public Pointer<T> setShortsAtOffset(long byteOffset, short[] values, int valuesOffset, int length)
public abstract short getShort()
public abstract short getShortAtOffset(long byteOffset)
getShort()
over this method.public short getShortAtIndex(long valueIndex)
getShortAtOffset(valueIndex * 2)
.valueIndex
- index of the value to readpublic short[] getShorts(int length)
public short[] getShorts()
public short[] getShortsAtOffset(long byteOffset, int length)
getShorts(int)
over this method.public abstract Pointer<T> setByte(byte value)
public abstract Pointer<T> setByteAtOffset(long byteOffset, byte value)
setByte(byte)
over this method.public Pointer<T> setByteAtIndex(long valueIndex, byte value)
setByteAtOffset(valueIndex * 1, value)
.valueIndex
- index of the value to writevalue
- byte value to writepublic Pointer<T> setBytes(byte[] values)
public Pointer<T> setBytesAtOffset(long byteOffset, byte[] values)
public Pointer<T> setBytesAtOffset(long byteOffset, byte[] values, int valuesOffset, int length)
public abstract byte getByte()
public abstract byte getByteAtOffset(long byteOffset)
getByte()
over this method.public byte getByteAtIndex(long valueIndex)
getByteAtOffset(valueIndex * 1)
.valueIndex
- index of the value to readpublic byte[] getBytes(int length)
public byte[] getBytes()
public byte[] getBytesAtOffset(long byteOffset, int length)
getBytes(int)
over this method.public abstract Pointer<T> setChar(char value)
public abstract Pointer<T> setCharAtOffset(long byteOffset, char value)
setChar(char)
over this method.public Pointer<T> setCharAtIndex(long valueIndex, char value)
setCharAtOffset(valueIndex * Platform.WCHAR_T_SIZE, value)
.valueIndex
- index of the value to writevalue
- char value to writepublic Pointer<T> setChars(char[] values)
public Pointer<T> setCharsAtOffset(long byteOffset, char[] values)
public Pointer<T> setCharsAtOffset(long byteOffset, char[] values, int valuesOffset, int length)
public abstract char getChar()
public abstract char getCharAtOffset(long byteOffset)
getChar()
over this method.public char getCharAtIndex(long valueIndex)
getCharAtOffset(valueIndex * Platform.WCHAR_T_SIZE)
.valueIndex
- index of the value to readpublic char[] getChars(int length)
public char[] getChars()
public char[] getCharsAtOffset(long byteOffset, int length)
getChars(int)
over this method.public abstract Pointer<T> setFloat(float value)
public abstract Pointer<T> setFloatAtOffset(long byteOffset, float value)
setFloat(float)
over this method.public Pointer<T> setFloatAtIndex(long valueIndex, float value)
setFloatAtOffset(valueIndex * 4, value)
.valueIndex
- index of the value to writevalue
- float value to writepublic Pointer<T> setFloats(float[] values)
public Pointer<T> setFloatsAtOffset(long byteOffset, float[] values)
public Pointer<T> setFloatsAtOffset(long byteOffset, float[] values, int valuesOffset, int length)
public abstract float getFloat()
public abstract float getFloatAtOffset(long byteOffset)
getFloat()
over this method.public float getFloatAtIndex(long valueIndex)
getFloatAtOffset(valueIndex * 4)
.valueIndex
- index of the value to readpublic float[] getFloats(int length)
public float[] getFloats()
public float[] getFloatsAtOffset(long byteOffset, int length)
getFloats(int)
over this method.public abstract Pointer<T> setDouble(double value)
public abstract Pointer<T> setDoubleAtOffset(long byteOffset, double value)
setDouble(double)
over this method.public Pointer<T> setDoubleAtIndex(long valueIndex, double value)
setDoubleAtOffset(valueIndex * 8, value)
.valueIndex
- index of the value to writevalue
- double value to writepublic Pointer<T> setDoubles(double[] values)
public Pointer<T> setDoublesAtOffset(long byteOffset, double[] values)
public Pointer<T> setDoublesAtOffset(long byteOffset, double[] values, int valuesOffset, int length)
public abstract double getDouble()
public abstract double getDoubleAtOffset(long byteOffset)
getDouble()
over this method.public double getDoubleAtIndex(long valueIndex)
getDoubleAtOffset(valueIndex * 8)
.valueIndex
- index of the value to readpublic double[] getDoubles(int length)
public double[] getDoubles()
public double[] getDoublesAtOffset(long byteOffset, int length)
getDoubles(int)
over this method.public abstract Pointer<T> setBoolean(boolean value)
public abstract Pointer<T> setBooleanAtOffset(long byteOffset, boolean value)
setBoolean(boolean)
over this method.public Pointer<T> setBooleanAtIndex(long valueIndex, boolean value)
setBooleanAtOffset(valueIndex * 1, value)
.valueIndex
- index of the value to writevalue
- boolean value to writepublic Pointer<T> setBooleans(boolean[] values)
public Pointer<T> setBooleansAtOffset(long byteOffset, boolean[] values)
public Pointer<T> setBooleansAtOffset(long byteOffset, boolean[] values, int valuesOffset, int length)
public abstract boolean getBoolean()
public abstract boolean getBooleanAtOffset(long byteOffset)
getBoolean()
over this method.public boolean getBooleanAtIndex(long valueIndex)
getBooleanAtOffset(valueIndex * 1)
.valueIndex
- index of the value to readpublic boolean[] getBooleans(int length)
public boolean[] getBooleans()
public boolean[] getBooleansAtOffset(long byteOffset, int length)
getBooleans(int)
over this method.public void getInts(int[] dest)
public void getInts(IntBuffer dest)
public void getIntsAtOffset(long byteOffset, int[] dest, int destOffset, int length)
public Pointer<T> setInts(IntBuffer values)
public Pointer<T> setIntsAtOffset(long byteOffset, IntBuffer values)
public Pointer<T> setIntsAtOffset(long byteOffset, IntBuffer values, long valuesOffset, long length)
public IntBuffer getIntBuffer(long length)
public IntBuffer getIntBuffer()
public IntBuffer getIntBufferAtOffset(long byteOffset, long length)
public void getLongs(long[] dest)
public void getLongs(LongBuffer dest)
public void getLongsAtOffset(long byteOffset, long[] dest, int destOffset, int length)
public Pointer<T> setLongs(LongBuffer values)
public Pointer<T> setLongsAtOffset(long byteOffset, LongBuffer values)
public Pointer<T> setLongsAtOffset(long byteOffset, LongBuffer values, long valuesOffset, long length)
public LongBuffer getLongBuffer(long length)
public LongBuffer getLongBuffer()
public LongBuffer getLongBufferAtOffset(long byteOffset, long length)
public void getShorts(short[] dest)
public void getShorts(ShortBuffer dest)
public void getShortsAtOffset(long byteOffset, short[] dest, int destOffset, int length)
public Pointer<T> setShorts(ShortBuffer values)
public Pointer<T> setShortsAtOffset(long byteOffset, ShortBuffer values)
public Pointer<T> setShortsAtOffset(long byteOffset, ShortBuffer values, long valuesOffset, long length)
public ShortBuffer getShortBuffer(long length)
public ShortBuffer getShortBuffer()
public ShortBuffer getShortBufferAtOffset(long byteOffset, long length)
public void getBytes(byte[] dest)
public void getBytes(ByteBuffer dest)
public void getBytesAtOffset(long byteOffset, byte[] dest, int destOffset, int length)
public Pointer<T> setBytes(ByteBuffer values)
public Pointer<T> setBytesAtOffset(long byteOffset, ByteBuffer values)
public Pointer<T> setBytesAtOffset(long byteOffset, ByteBuffer values, long valuesOffset, long length)
public ByteBuffer getByteBuffer(long length)
public ByteBuffer getByteBuffer()
public ByteBuffer getByteBufferAtOffset(long byteOffset, long length)
public Pointer<T> setChars(CharBuffer values)
public Pointer<T> setCharsAtOffset(long byteOffset, CharBuffer values)
public Pointer<T> setCharsAtOffset(long byteOffset, CharBuffer values, long valuesOffset, long length)
public void getFloats(float[] dest)
public void getFloats(FloatBuffer dest)
public void getFloatsAtOffset(long byteOffset, float[] dest, int destOffset, int length)
public Pointer<T> setFloats(FloatBuffer values)
public Pointer<T> setFloatsAtOffset(long byteOffset, FloatBuffer values)
public Pointer<T> setFloatsAtOffset(long byteOffset, FloatBuffer values, long valuesOffset, long length)
public FloatBuffer getFloatBuffer(long length)
public FloatBuffer getFloatBuffer()
public FloatBuffer getFloatBufferAtOffset(long byteOffset, long length)
public void getDoubles(double[] dest)
public void getDoubles(DoubleBuffer dest)
public void getDoublesAtOffset(long byteOffset, double[] dest, int destOffset, int length)
public Pointer<T> setDoubles(DoubleBuffer values)
public Pointer<T> setDoublesAtOffset(long byteOffset, DoubleBuffer values)
public Pointer<T> setDoublesAtOffset(long byteOffset, DoubleBuffer values, long valuesOffset, long length)
public DoubleBuffer getDoubleBuffer(long length)
public DoubleBuffer getDoubleBuffer()
public DoubleBuffer getDoubleBufferAtOffset(long byteOffset, long length)
public String getString(Pointer.StringType type)
getStringAtOffset(long, StringType, Charset)
for more options.type
- Type of the native String to read. See Pointer.StringType
for details on the supported types.public String getString(Pointer.StringType type, Charset charset)
getStringAtOffset(long, StringType, Charset)
for more options.type
- Type of the native String to read. See Pointer.StringType
for details on the supported types.charset
- Character set used to convert bytes to String characters. If null, Charset.defaultCharset()
will be usedpublic String getStringAtOffset(long byteOffset, Pointer.StringType type, Charset charset)
byteOffset
- charset
- Character set used to convert bytes to String characters. If null, Charset.defaultCharset()
will be usedtype
- Type of the native String to read. See Pointer.StringType
for details on the supported types.public Pointer<T> setString(String s, Pointer.StringType type)
setStringAtOffset(long, String, StringType, Charset)
for more options.s
- string to writetype
- Type of the native String to write. See Pointer.StringType
for details on the supported types.public Pointer<T> setStringAtOffset(long byteOffset, String s, Pointer.StringType type, Charset charset)
byteOffset
- s
- string to writecharset
- Character set used to convert String characters to bytes. If null, Charset.defaultCharset()
will be usedtype
- Type of the native String to write. See Pointer.StringType
for details on the supported types.public static Pointer<?> pointerToString(String string, Pointer.StringType type, Charset charset)
Pointer.StringType
for details on the supported types).setString(String, StringType)
, getString(StringType)
.charset
- Character set used to convert String characters to bytes. If null, Charset.defaultCharset()
will be usedtype
- Type of the native String to create.public static Pointer<Byte> pointerToCString(String string)
Pointer.StringType.C
).setCString(String)
, getCString()
.pointerToString(String, StringType, Charset)
for choice of the String type or Charset.public static Pointer<Pointer<Byte>> pointerToCStrings(String... strings)
public static Pointer<Character> pointerToWideCString(String string)
Pointer.StringType.WideC
).setWideCString(String)
, getWideCString()
.pointerToString(String, StringType, Charset)
for choice of the String type or Charset.public static Pointer<Pointer<Character>> pointerToWideCStrings(String... strings)
public String getCString()
Pointer.StringType.C
).getCStringAtOffset(long)
, getString(StringType)
and getStringAtOffset(long, StringType, Charset)
for more optionspublic String getCStringAtOffset(long byteOffset)
Pointer.StringType.C
).getStringAtOffset(long, StringType, Charset)
for more optionspublic Pointer<T> setCString(String s)
Pointer.StringType.C
).setCStringAtOffset(long, String)
and setStringAtOffset(long, String, StringType, Charset)
for more optionspublic Pointer<T> setCStringAtOffset(long byteOffset, String s)
Pointer.StringType.C
).setStringAtOffset(long, String, StringType, Charset)
for more optionspublic String getWideCString()
Pointer.StringType.WideC
).getWideCStringAtOffset(long)
, getString(StringType)
and getStringAtOffset(long, StringType, Charset)
for more optionspublic String getWideCStringAtOffset(long byteOffset)
Pointer.StringType.WideC
).getStringAtOffset(long, StringType, Charset)
for more optionspublic Pointer<T> setWideCString(String s)
Pointer.StringType.WideC
).setWideCStringAtOffset(long, String)
and setStringAtOffset(long, String, StringType, Charset)
for more optionspublic Pointer<T> setWideCStringAtOffset(long byteOffset, String s)
Pointer.StringType.WideC
).setStringAtOffset(long, String, StringType, Charset)
for more optionspublic void clearValidBytes()
public void clearBytes(long length)
public void clearBytesAtOffset(long byteOffset, long length, byte value)
value
to each of the length
bytes at the address pointed to by this pointer shifted by a byteOffset
public Pointer<T> findByte(long byteOffset, byte value, long searchLength)
public final T apply(long index)
get(long)
defined for more natural use from the Scala language.public final void update(long index, T element)
set(long, Object)
defined for more natural use from the Scala language.public T[] toArray()
getArray()
.IndexOutOfBoundsException
- if this pointer's bounds are unknownpublic <U> U[] toArray(U[] array)
getArray()
.IndexOutOfBoundsException
- if this pointer's bounds are unknownpublic NativeList<T> asList()
Pointer.ListType.FixedCapacity
native list that uses this pointer as storage (and has this pointer's pointed valid elements as initial content).asList(ListType)
(Pointer.ListType.FixedCapacity
).public NativeList<T> asList(Pointer.ListType type)
Pointer.ListType.Dynamic
and if its capacity is grown at some point, this pointer will probably no longer point to the native memory storage of the list, so you need to get back the pointer with NativeList.getPointer()
when you're done mutating the list.public static <E> NativeList<E> allocateList(PointerIO<E> io, long capacity)
Pointer.ListType.Dynamic
list with the provided initial capacity (see Pointer.ListType.Dynamic
).io
- Type of the elements of the listcapacity
- Initial capacity of the listpublic static <E> NativeList<E> allocateList(Class<E> type, long capacity)
Pointer.ListType.Dynamic
list with the provided initial capacity (see Pointer.ListType.Dynamic
).type
- Type of the elements of the listcapacity
- Initial capacity of the listpublic static <E> NativeList<E> allocateList(Type type, long capacity)
Pointer.ListType.Dynamic
list with the provided initial capacity (see Pointer.ListType.Dynamic
).type
- Type of the elements of the listcapacity
- Initial capacity of the listpublic Pointer<T> setIntegralAtOffset(long byteOffset, org.bridj.AbstractIntegral value)
public long getIntegralAtOffset(long byteOffset, int integralSize)
Copyright © 2009-2015. All Rights Reserved.