Class Pointer
- java.lang.Object
-
- jnr.ffi.Pointer
-
- Direct Known Subclasses:
AbstractMemoryIO
public abstract class Pointer extends Object
A native memory address. This class provides operations on a native memory address. MostPointer
instances will represent direct memory (that is, a fixed address in the process address space, directly accessible by native code), however, it is possible to wrap a javabyte
array in aPointer
instance to pass to a native function as a memory address. SeeisDirect()
for more information.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long
address()
Gets the native address of this memory object (optional operation).abstract Object
array()
Returns the array that backs this pointer.abstract int
arrayLength()
Returns the length of this pointer's backing array that is used by this pointer.abstract int
arrayOffset()
Returns the offset within this pointer's backing array of the first element.abstract void
checkBounds(long offset, long length)
Checks that the memory region is within the bounds of this memory objectabstract void
get(long offset, byte[] dst, int idx, int len)
Bulk get method for multiplebyte
values.abstract void
get(long offset, double[] dst, int idx, int len)
Bulk get method for multipledouble
values.abstract void
get(long offset, float[] dst, int idx, int len)
Bulk get method for multiplefloat
values.abstract void
get(long offset, int[] dst, int idx, int len)
Bulk get method for multipleint
values.abstract void
get(long offset, long[] dst, int idx, int len)
Bulk get method for multiplelong
values.abstract void
get(long offset, short[] dst, int idx, int len)
Bulk get method for multipleshort
values.void
get(long offset, Pointer[] dst, int idx, int len)
Bulk get method for multiplePointer
values.abstract long
getAddress(long offset)
Reads a native memory address value at the given offset.abstract byte
getByte(long offset)
Reads anbyte
(8 bit) value at the given offset.abstract double
getDouble(long offset)
Reads adouble
(64 bit) value at the given offset.abstract float
getFloat(long offset)
Reads afloat
(32 bit) value at the given offset.abstract int
getInt(long offset)
Reads anint
(32 bit) value at the given offset.abstract long
getInt(Type type, long offset)
Reads an integer value of the given type, at the given offset.abstract long
getLong(long offset)
Reads along
(64 bit) value at the given offset.abstract long
getLongLong(long offset)
Reads along
(64 bit) value at the given offset.abstract long
getNativeLong(long offset)
Reads a nativelong
value at the given offset.Pointer[]
getNullTerminatedPointerArray(long offset)
String[]
getNullTerminatedStringArray(long offset)
abstract Pointer
getPointer(long offset)
Reads anPointer
value at the given offset.abstract Pointer
getPointer(long offset, long size)
Reads anPointer
value at the given offset.Runtime
getRuntime()
Gets theRuntime
thisPointer
instance belongs to.abstract short
getShort(long offset)
Reads ashort
(16 bit) value at the given offset.abstract String
getString(long offset)
Reads anString
value at the given offset.abstract String
getString(long offset, int maxLength, Charset cs)
Reads aString
value at the given offset, using a specificCharset
abstract boolean
hasArray()
Indicates whether thisPointer
instance is backed by an array.abstract int
indexOf(long offset, byte value)
Returns the location of a byte value within the memory area represented by thisPointer
.abstract int
indexOf(long offset, byte value, int maxlen)
Returns the location of a byte value within the memory area represented by thisPointer
.boolean
isDirect()
Indicates whether or not this memory object represents a native memory address.static Pointer
newIntPointer(Runtime runtime, long address)
Wraps an integer value in an opaquePointer
instance.abstract void
put(long offset, byte[] src, int idx, int len)
Bulk put method for multiplebyte
values.abstract void
put(long offset, double[] src, int idx, int len)
Bulk put method for multipledouble
values.abstract void
put(long offset, float[] src, int idx, int len)
Bulk put method for multiplefloat
values.abstract void
put(long offset, int[] src, int idx, int len)
Bulk put method for multipleint
values.abstract void
put(long offset, long[] src, int idx, int len)
Bulk put method for multiplelong
values.abstract void
put(long offset, short[] src, int idx, int len)
Bulk put method for multipleshort
values.void
put(long offset, Pointer[] src, int idx, int len)
Bulk put method for multiplePointer
values.abstract void
putAddress(long offset, long value)
Writes a native memory address value at the given offset.abstract void
putAddress(long offset, Address value)
Writes a native memory address value at the given offset.abstract void
putByte(long offset, byte value)
Writes abyte
(8 bit) value at the given offset.abstract void
putDouble(long offset, double value)
Writes adouble
(64 bit, double precision) value at the given offset.abstract void
putFloat(long offset, float value)
Writes afloat
(32 bit, single precision) value at the given offset.abstract void
putInt(long offset, int value)
Writes anint
(32 bit) value at the given offset.abstract void
putInt(Type type, long offset, long value)
Writes an integer of a specific type, at the given offset.abstract void
putLong(long offset, long value)
Writes anative long
value at the given offset.abstract void
putLongLong(long offset, long value)
Writes along
(64 bit) value at the given offset.abstract void
putNativeLong(long offset, long value)
Writes a nativelong
value at the given offset.abstract void
putPointer(long offset, Pointer value)
Writes aPointer
value at the given offset.abstract void
putShort(long offset, short value)
Writes ashort
(16 bit) value at the given offset.abstract void
putString(long offset, String string, int maxLength, Charset cs)
Writes aString
value at the given offset, using a specificCharset
abstract void
setMemory(long offset, long size, byte value)
Sets the value of each byte in the memory area represented by thisPointer
.abstract long
size()
Gets the size of this memory object in bytes (optional operation).abstract Pointer
slice(long offset)
Creates a newPointer
representing a sub-region of the memory referred to by thisPointer
.abstract Pointer
slice(long offset, long size)
Creates a newPointer
representing a sub-region of the memory referred to by thisPointer
.String
toString()
abstract void
transferFrom(long offset, Pointer src, long srcOffset, long count)
Bulk data transfer from one memory location to another.abstract void
transferTo(long offset, Pointer dst, long dstOffset, long count)
Bulk data transfer from one memory location to another.static Pointer
wrap(Runtime runtime, long address)
Wraps a native address in aPointer
instance.static Pointer
wrap(Runtime runtime, long address, long size)
Wraps a native address in aPointer
instance.static Pointer
wrap(Runtime runtime, ByteBuffer buffer)
Wraps an existing ByteBuffer in aPointer
implementation so it can be used as a parameter to native functions.
-
-
-
Constructor Detail
-
Pointer
protected Pointer(Runtime runtime, long address, boolean direct)
-
-
Method Detail
-
wrap
public static Pointer wrap(Runtime runtime, long address)
Wraps a native address in aPointer
instance.- Parameters:
runtime
- theRuntime
of the pointer.address
- theaddress
to wrap in a Pointer instance.- Returns:
- a
Pointer
instance.
-
wrap
public static Pointer wrap(Runtime runtime, long address, long size)
Wraps a native address in aPointer
instance.- Parameters:
runtime
- theRuntime
of the pointer.address
- theaddress
to wrap in a Pointer instance.size
- the size of the native memory region.- Returns:
- a
Pointer
instance.
-
wrap
public static Pointer wrap(Runtime runtime, ByteBuffer buffer)
Wraps an existing ByteBuffer in aPointer
implementation so it can be used as a parameter to native functions.Wrapping a ByteBuffer is only neccessary if the native function parameter was declared as a
Pointer
. The if the method will always be used withByteBuffer
parameters, then the parameter type can just be declared asByteBuffer
and the conversion will be performed automatically.- Parameters:
runtime
- theRuntime
the wrappedByteBuffer
will be used with.buffer
- theByteBuffer
to wrap.- Returns:
- a
Pointer
instance that will proxy all accesses to the ByteBuffer contents.
-
newIntPointer
public static Pointer newIntPointer(Runtime runtime, long address)
Wraps an integer value in an opaquePointer
instance. This is a Pointer instance that throws errors when any of the memory access methods are used, but can be otherwise used interchangeably with a real Pointer.- Parameters:
runtime
- theRuntime
of the pointer.address
- theaddress
to wrap in a Pointer instance.- Returns:
- a
Pointer
instance.
-
isDirect
public final boolean isDirect()
Indicates whether or not this memory object represents a native memory address.Memory objects can be either direct (representing native memory), or non-direct (representing java heap memory).
Non-direct memory objects can still be passed to native functions as pointer (void *, char *, etc) parameters, but the java memory will first be copied to a temporary native memory area. The temporary memory area will then be used as the parameter value for the call. If needed, the java memory will be automatically reloaded from the temporary native memory after the native function returns.
Note: the transient nature of the temporary memory allocated for non-direct memory means native functions which store the address value passed to them will fail in unpredictable ways when using non-direct memory. You will need to explicitly allocate direct memory to use those types of functions.
- Returns:
- true if, and only if, this memory object represents a native address.
-
address
public final long address()
Gets the native address of this memory object (optional operation).- Returns:
- the native address of this memory object. If this object is not a native memory address, an address of zero is returned.
-
getRuntime
public final Runtime getRuntime()
Gets theRuntime
thisPointer
instance belongs to.- Returns:
- the
Runtime
instance of thisPointer
.
-
size
public abstract long size()
Gets the size of this memory object in bytes (optional operation).- Returns:
- the size of the memory area this
Pointer
points to. If the size is unknown,Long.MAX_VALUE
is returned}.
-
hasArray
public abstract boolean hasArray()
Indicates whether thisPointer
instance is backed by an array.- Returns:
- true if, and only if, this memory object is backed by an array
-
array
public abstract Object array()
Returns the array that backs this pointer.- Returns:
- The array that backs this pointer.
- Throws:
UnsupportedOperationException
- if this pointer does not have a backing array.
-
arrayOffset
public abstract int arrayOffset()
Returns the offset within this pointer's backing array of the first element.- Returns:
- The offset of the first element on the backing array
- Throws:
UnsupportedOperationException
- if this pointer does not have a backing array
-
arrayLength
public abstract int arrayLength()
Returns the length of this pointer's backing array that is used by this pointer.- Returns:
- The length of the backing array used
- Throws:
UnsupportedOperationException
- if this pointer does not have a backing array
-
getByte
public abstract byte getByte(long offset)
Reads anbyte
(8 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the
byte
value at the offset.
-
getShort
public abstract short getShort(long offset)
Reads ashort
(16 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the
short
value at the offset.
-
getInt
public abstract int getInt(long offset)
Reads anint
(32 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the
int
value contained in the memory at the offset.
-
getLong
public abstract long getLong(long offset)
Reads along
(64 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the
long
value at the offset.
-
getLongLong
public abstract long getLongLong(long offset)
Reads along
(64 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the
long
value at the offset.
-
getFloat
public abstract float getFloat(long offset)
Reads afloat
(32 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the
float
value at the offset.
-
getDouble
public abstract double getDouble(long offset)
Reads adouble
(64 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the
double
value at the offset.
-
getNativeLong
public abstract long getNativeLong(long offset)
Reads a nativelong
value at the given offset.A native
long
can be either 32 or 64 bits in size, depending on the cpu architecture, and the C ABI in use.For windows, a long is always 32 bits (4 bytes) in size, but on unix systems, a long on a 32bit system is 32 bits, and on a 64bit system, is 64 bits.
- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the native
long
value at the offset. - See Also:
NativeLong
-
getInt
public abstract long getInt(Type type, long offset)
Reads an integer value of the given type, at the given offset.- Parameters:
type
- Type of integer to read.offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the
int
value contained in the memory at the offset.
-
putByte
public abstract void putByte(long offset, byte value)
Writes abyte
(8 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- thebyte
value to be written.
-
putShort
public abstract void putShort(long offset, short value)
Writes ashort
(16 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- theshort
value to be written.
-
putInt
public abstract void putInt(long offset, int value)
Writes anint
(32 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- theint
value to be written.
-
putLong
public abstract void putLong(long offset, long value)
Writes anative long
value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- thelong
value to be written.
-
putLongLong
public abstract void putLongLong(long offset, long value)
Writes along
(64 bit) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- thelong
value to be written.
-
putFloat
public abstract void putFloat(long offset, float value)
Writes afloat
(32 bit, single precision) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- thefloat
value to be written.
-
putDouble
public abstract void putDouble(long offset, double value)
Writes adouble
(64 bit, double precision) value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- thedouble
value to be written.
-
putNativeLong
public abstract void putNativeLong(long offset, long value)
Writes a nativelong
value at the given offset.A native
long
can be either 32 or 64 bits in size, depending on the cpu architecture, and the C ABI in use.For windows, a long is always 32 bits (4 bytes) in size, but on unix systems, a long on a 32bit system is 32 bits, and on a 64bit system, is 64 bits.
- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- the nativelong
value to be written.
-
putInt
public abstract void putInt(Type type, long offset, long value)
Writes an integer of a specific type, at the given offset.- Parameters:
type
- The integer type.offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- theint
value to be written.
-
getAddress
public abstract long getAddress(long offset)
Reads a native memory address value at the given offset.A native address can be either 32 or 64 bits in size, depending on the cpu architecture.
- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the native address value contained in the memory at the offset
- See Also:
Address
-
putAddress
public abstract void putAddress(long offset, long value)
Writes a native memory address value at the given offset.A native address can be either 32 or 64 bits in size, depending on the cpu architecture.
- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- The native address value to be written.- See Also:
Address
-
putAddress
public abstract void putAddress(long offset, Address value)
Writes a native memory address value at the given offset.A native address can be either 32 or 64 bits in size, depending on the cpu architecture.
- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- The native address value to be written.- See Also:
Address
-
get
public abstract void get(long offset, byte[] dst, int idx, int len)
Bulk get method for multiplebyte
values. This method reads multiplebyte
values from consecutive addresses, beginning at the given offset, and stores them in an array.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the first value will be read.dst
- the array into which values are to be stored.idx
- the start index in thedst
array to begin storing the values.len
- the number of values to be read.
-
put
public abstract void put(long offset, byte[] src, int idx, int len)
Bulk put method for multiplebyte
values. This method writes multiplebyte
values to consecutive addresses, beginning at the given offset, from an array.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the first value will be written.src
- the array to get values from.idx
- the start index in thedst
array to begin reading values.len
- the number of values to be written.
-
get
public abstract void get(long offset, short[] dst, int idx, int len)
Bulk get method for multipleshort
values. This method reads multipleshort
values from consecutive addresses, beginning at the given offset, and stores them in an array.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the first value will be read.dst
- The array into which values are to be stored.idx
- the start index in thedst
array to begin storing the values.len
- the number of values to be read.
-
put
public abstract void put(long offset, short[] src, int idx, int len)
Bulk put method for multipleshort
values. This method writes multipleshort
values to consecutive addresses, beginning at the given offset, from an array.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the first value will be written.src
- the array to get values from.idx
- the start index in thedst
array to begin reading values.len
- the number of values to be written.
-
get
public abstract void get(long offset, int[] dst, int idx, int len)
Bulk get method for multipleint
values. This method reads multipleint
values from consecutive addresses, beginning at the given offset, and stores them in an array.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the first value will be read.dst
- The array into which values are to be stored.idx
- the start index in thedst
array to begin storing the values.len
- the number of values to be read.
-
put
public abstract void put(long offset, int[] src, int idx, int len)
Bulk put method for multipleint
values. This method writes multipleint
values to consecutive addresses, beginning at the given offset, from an array.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the first value will be written.src
- the array to get values from.idx
- the start index in thedst
array to begin reading values.len
- the number of values to be written.
-
get
public abstract void get(long offset, long[] dst, int idx, int len)
Bulk get method for multiplelong
values. This method reads multiplelong
values from consecutive addresses, beginning at the given offset, and stores them in an array.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the first value will be read.dst
- The array into which values are to be stored.idx
- the start index in thedst
array to begin storing the values.len
- the number of values to be read.
-
put
public abstract void put(long offset, long[] src, int idx, int len)
Bulk put method for multiplelong
values. This method writes multiplelong
values to consecutive addresses, beginning at the given offset, from an array.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the first value will be written.src
- the array to get values from.idx
- the start index in thedst
array to begin reading values.len
- the number of values to be written.
-
get
public abstract void get(long offset, float[] dst, int idx, int len)
Bulk get method for multiplefloat
values. This method reads multiplefloat
values from consecutive addresses, beginning at the given offset, and stores them in an array.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the first value will be read.dst
- The array into which values are to be stored.idx
- the start index in thedst
array to begin storing the values.len
- the number of values to be read.
-
put
public abstract void put(long offset, float[] src, int idx, int len)
Bulk put method for multiplefloat
values. This method writes multiplefloat
values to consecutive addresses, beginning at the given offset, from an array.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the first value will be written.src
- the array to get values from.idx
- the start index in thedst
array to begin reading values.len
- the number of values to be written.
-
get
public abstract void get(long offset, double[] dst, int idx, int len)
Bulk get method for multipledouble
values. This method reads multipledouble
values from consecutive addresses, beginning at the given offset, and stores them in an array.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the first value will be read.dst
- The array into which values are to be stored.idx
- the start index in thedst
array to begin storing the values.len
- the number of values to be read.
-
put
public abstract void put(long offset, double[] src, int idx, int len)
Bulk put method for multipledouble
values. This method writes multipledouble
values to consecutive addresses, beginning at the given offset, from an array.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the first value will be written.src
- the array to get values from.idx
- the start index in thedst
array to begin reading values.len
- the number of values to be written.
-
getPointer
public abstract Pointer getPointer(long offset)
Reads anPointer
value at the given offset.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the
Pointer
value read from memory.
-
getPointer
public abstract Pointer getPointer(long offset, long size)
Reads anPointer
value at the given offset.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the value will be read.size
- the maximum size of the memory location the returnedPointer
represents.- Returns:
- the
Pointer
value read from memory.
-
putPointer
public abstract void putPointer(long offset, Pointer value)
Writes aPointer
value at the given offset.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- thePointer
value to be written to memory.
-
getString
public abstract String getString(long offset)
Reads anString
value at the given offset.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the
String
value read from memory.
-
getString
public abstract String getString(long offset, int maxLength, Charset cs)
Reads aString
value at the given offset, using a specificCharset
- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the value will be read.maxLength
- the maximum size of memory to search for a NUL byte.cs
- theCharset
to use to decode the string.- Returns:
- the
String
value read from memory.
-
putString
public abstract void putString(long offset, String string, int maxLength, Charset cs)
Writes aString
value at the given offset, using a specificCharset
- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the value will be written.string
- the string to be written.maxLength
- the maximum size of memory to use to store the string.cs
- theCharset
to use to decode the string.
-
slice
public abstract Pointer slice(long offset)
Creates a newPointer
representing a sub-region of the memory referred to by thisPointer
.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the newPointer
will start.- Returns:
- a
Pointer
instance representing the new sub-region.
-
slice
public abstract Pointer slice(long offset, long size)
Creates a newPointer
representing a sub-region of the memory referred to by thisPointer
.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the newPointer
will start.size
- the maximum size of the memory sub-region.- Returns:
- a
Pointer
instance representing the new sub-region.
-
transferTo
public abstract void transferTo(long offset, Pointer dst, long dstOffset, long count)
Bulk data transfer from one memory location to another.- Parameters:
offset
- the offset from the start of the memory location thisPointer
represents to begin copying from.dst
- the destination memory location to transfer data to.dstOffset
- the offset from the start of the memory location the destinationPointer
represents to begin copying to.count
- the number of bytes to transfer.
-
transferFrom
public abstract void transferFrom(long offset, Pointer src, long srcOffset, long count)
Bulk data transfer from one memory location to another.- Parameters:
offset
- the offset from the start of the memory location thisPointer
represents to begin copying to.src
- the destination memory location to transfer data from.srcOffset
- the offset from the start of the memory location the destinationPointer
represents to begin copying from.count
- the number of bytes to transfer.
-
checkBounds
public abstract void checkBounds(long offset, long length)
Checks that the memory region is within the bounds of this memory object- Parameters:
offset
- the starting point within this memory region.length
- the length of the memory region in bytes- Throws:
IndexOutOfBoundsException
- if the memory region is not within the bounds.
-
setMemory
public abstract void setMemory(long offset, long size, byte value)
Sets the value of each byte in the memory area represented by thisPointer
. to a specified value.- Parameters:
offset
- the offset from the start of the memory location thisPointer
represents to begin writing to.size
- the number of bytes to set to the value.value
- the value to set each byte to.
-
indexOf
public abstract int indexOf(long offset, byte value)
Returns the location of a byte value within the memory area represented by thisPointer
.- Parameters:
offset
- the offset from the start of the memory location thisPointer
represents to begin searching.value
- thebyte
value to locate.- Returns:
- the offset from the start of the search area (i.e. relative to the offset parameter), or -1 if not found.
-
indexOf
public abstract int indexOf(long offset, byte value, int maxlen)
Returns the location of a byte value within the memory area represented by thisPointer
.- Parameters:
offset
- the offset from the start of the memory location thisPointer
represents to begin searching.value
- thebyte
value to locate.maxlen
- the maximum number of bytes to search for the desired value.- Returns:
- the offset from the start of the search area (i.e. relative to the offset parameter), or -1 if not found.
-
get
public void get(long offset, Pointer[] dst, int idx, int len)
Bulk get method for multiplePointer
values. This method reads multiplePointer
values from consecutive addresses, beginning at the given offset, and stores them in an array.- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the first value will be read.dst
- The array into which values are to be stored.idx
- the start index in thedst
array to begin storing the values.len
- the number of values to be read.
-
put
public void put(long offset, Pointer[] src, int idx, int len)
Bulk put method for multiplePointer
values. This method writes multiplePointer
values to consecutive addresses, beginning at the given offset, from an array.- Parameters:
offset
- the offset from the start of the memory thisPointer
represents at which the first value will be written.src
- the array to get values from.idx
- the start index in thesrc
array to begin reading values.len
- the number of values to be written.
-
getNullTerminatedStringArray
public String[] getNullTerminatedStringArray(long offset)
-
getNullTerminatedPointerArray
public Pointer[] getNullTerminatedPointerArray(long offset)
-
-