Function
, Memory
An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a native pointer. The native pointer could be any
typeof native pointer. Methods such as
write
,
read
,
getXXX
, and
setXXX
, provide means to access memory underlying the native pointer.
While a constructor exists to create a Pointer from an integer value, it's not generally a good idea to be creating pointers that way.
Felder
Convenience constant, same as null
.
protected long
Pointer value of the real native pointer.
Konstruktoren
Derived class must assign peer pointer value.
Create from native pointer.
void
Zero memory for the given number of bytes.
Convenience constant, equivalent to (void*)CONSTANT
.
Convenience constant, equivalent to (void*)CONSTANT
.
dump(long offset, int size)
Dump memory for debugging purposes.
boolean
byte
Indirect the native pointer as a pointer to byte
.
byte[]
Read a native array of bytes of size
arraySize
from the given
offset
from this
Pointer
.
Get a ByteBuffer mapped to the memory pointed to by the pointer, ensuring the buffer uses native byte order.
char
Indirect the native pointer as a pointer to wchar_t
.
char[]
Read a native array of wchar_t of size
arraySize
from the given
offset
from this
Pointer
.
double
Indirect the native pointer as a pointer to double
.
double[]
Read a native array of double of size
arraySize
from the given
offset
from this
Pointer
.
float
Indirect the native pointer as a pointer to float
.
float[]
Read a native array of float of size
arraySize
from the given
offset
from this
Pointer
.
int
Indirect the native pointer as a pointer to int
.
int[]
Read a native array of int32 of size
arraySize
from the given
offset
from this
Pointer
.
long
Indirect the native pointer as a pointer to long
.
long[]
Read a native array of int64 of size
arraySize
from the given
offset
from this
Pointer
.
Indirect the native pointer as a pointer to long
.
Indirect the native pointer as a pointer to pointer.
Returns an array of
Pointer
of the requested size.
short
Indirect the native pointer as a pointer to short
.
short[]
Read a native array of int16 of size
arraySize
from the given
offset
from this
Pointer
.
Copy native memory to a Java String.
Copy native memory to a Java String using the requested encoding.
Returns an array of String
based on a native array of char *
.
Returns an array of String
based on a native array of char *
, using the given array length.
Returns an array of String
based on a native array of char*
or wchar_t*
based on the wide
parameter, using the given array length.
Returns an array of String
based on a native array of char *
, using the requested encoding.
Read a wide (const wchar_t *
) string from memory.
int
long
Returns the offset of the given value in memory from the given offset, or -1 if the value is not found.
static long
Read the native peer value.
static void
Set the native peer value.
void
read(long offset, byte[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
void
read(long offset, char[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
void
read(long offset, double[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
void
read(long offset, float[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
void
read(long offset, int[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
void
read(long offset, long[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
void
read(long offset, short[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
void
read(long offset, Pointer[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
void
Set value
at location being pointed to.
void
Set value
at location being pointed to.
void
Set value
at location being pointed to.
void
Set value
at location being pointed to.
void
setInt(long offset, int value)
Set value
at location being pointed to.
void
Set value
at location being pointed to.
void
setMemory(long offset, long length, byte value)
Write value
to the requested bank of memory.
void
Set value
at location being pointed to.
void
Set value
at location being pointed to.
void
Set value
at location being pointed to.
void
Copy string value
to the location being pointed to as a wide string (wchar_t*
).
void
void
Copy string value
to the location being pointed to, using the requested encoding.
(Package privat) void
void
Copy string value
to the location being pointed to as a wide string (wchar_t*
).
Provide a view of this memory using the given offset to calculate a new base address.
share(long offset, long sz)
Provide a view of this memory using the given offset to calculate a new base address, bounds-limiting the memory with the given size.
void
write(long offset, byte[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
void
write(long offset, char[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
void
write(long offset, double[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
void
write(long offset, float[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
void
write(long offset, int[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
void
write(long offset, long[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
void
write(long offset, short[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
void
Write the given array of Pointer to native memory.
Convenience constant, same as null
.
protected long peer
Pointer value of the real native pointer. Use long to be 64-bit safe.
Pointer()
Derived class must assign peer pointer value.
public Pointer(long peer)
Create from native pointer. Don't use this unless you know what you're doing.
Convenience constant, equivalent to (void*)CONSTANT
.
Convenience constant, equivalent to (void*)CONSTANT
. This version will avoid setting any of the high bits on 64-bit systems.
public void clear(long size)
Zero memory for the given number of bytes.
public int hashCode()
public long indexOf(long offset, byte value)
Returns the offset of the given value in memory from the given offset, or -1 if the value is not found.
public void read(long offset, byte[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
offset
- byte offset from pointer from which data is copied
buf
- byte
array into which data is copied
index
- array index to which data is copied
length
- number of elements from native pointer that must be copied
public void read(long offset, short[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
offset
- byte offset from pointer from which data is copied
buf
- short
array into which data is copied
index
- array index to which data is copied
length
- number of elements from native pointer that must be copied
public void read(long offset, char[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
offset
- byte offset from pointer from which data is copied
buf
- char
array into which data is copied
index
- array index to which data is copied
length
- number of elements from native pointer that must be copied
public void read(long offset, int[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
offset
- byte offset from pointer from which data is copied
buf
- int
array into which data is copied
index
- array index to which data is copied
length
- number of elements from native pointer that must be copied
public void read(long offset, long[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
offset
- byte offset from pointer from which data is copied
buf
- long
array into which data is copied
index
- array index to which data is copied
length
- number of elements from native pointer that must be copied
public void read(long offset, float[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
offset
- byte offset from pointer from which data is copied
buf
- float
array into which data is copied
index
- array index to which data is copied
length
- number of elements from native pointer that must be copied
public void read(long offset, double[] buf, int index, int length)
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
offset
- byte offset from pointer from which data is copied
buf
- double
array into which data is copied
index
- array index to which data is copied
length
- number of elements from native pointer that must be copied
Indirect the native pointer, copying from memory pointed to by native pointer, into the specified array.
offset
- byte offset from pointer from which data is copied
buf
- Pointer
array into which data is copied
index
- array index to which data is copied
length
- number of elements from native pointer that must be copied
public void write(long offset, byte[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
offset
- byte offset from pointer into which data is copied
buf
- byte
array from which to copy
index
- array index from which to start copying
length
- number of elements from buf
that must be copied
public void write(long offset, short[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
offset
- byte offset from pointer into which data is copied
buf
- short
array from which to copy
index
- array index from which to start copying
length
- number of elements from buf
that must be copied
public void write(long offset, char[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
offset
- byte offset from pointer into which data is copied
buf
- char
array from which to copy
index
- array index from which to start copying
length
- number of elements from buf
that must be copied
public void write(long offset, int[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
offset
- byte offset from pointer into which data is copied
buf
- int
array from which to copy
index
- array index from which to start copying
length
- number of elements from buf
that must be copied
public void write(long offset, long[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
offset
- byte offset from pointer into which data is copied
buf
- long
array from which to copy
index
- array index from which to start copying
length
- number of elements from buf
that must be copied
public void write(long offset, float[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
offset
- byte offset from pointer into which data is copied
buf
- float
array from which to copy
index
- array index from which to start copying
length
- number of elements from buf
that must be copied
public void write(long offset, double[] buf, int index, int length)
Indirect the native pointer, copying into memory pointed to by native pointer, from the specified array.
offset
- byte offset from pointer into which data is copied
buf
- double
array from which to copy
index
- array index from which to start copying
length
- number of elements from buf
that must be copied
Write the given array of Pointer to native memory.
bOff
- byte offset from pointer into which data is copied
buf
- Pointer
array from which to copy
index
- array index from which to start copying
length
- number of elements from buf
that must be copied
public byte getByte(long offset)
Indirect the native pointer as a pointer to byte
. This is equivalent to the expression *((jbyte *)((char *)Pointer + offset))
.
offset
- offset from pointer to perform the indirection
byte
value being pointed to
public char getChar(long offset)
Indirect the native pointer as a pointer to wchar_t
. This is equivalent to the expression *((wchar_t*)((char *)Pointer + offset))
.
offset
- offset from pointer to perform the indirection
wchar_t
value being pointed to
public short getShort(long offset)
Indirect the native pointer as a pointer to short
. This is equivalent to the expression *((jshort *)((char *)Pointer + offset))
.
offset
- byte offset from pointer to perform the indirection
short
value being pointed to
public int getInt(long offset)
Indirect the native pointer as a pointer to int
. This is equivalent to the expression *((jint *)((char *)Pointer + offset))
.
offset
- byte offset from pointer to perform the indirection
int
value being pointed to
public long getLong(long offset)
Indirect the native pointer as a pointer to long
. This is equivalent to the expression *((jlong *)((char *)Pointer + offset))
.
offset
- byte offset from pointer to perform the indirection
long
value being pointed to
Indirect the native pointer as a pointer to long
. This is equivalent to the expression *((long *)((char *)Pointer + offset))
.
offset
- byte offset from pointer to perform the indirection
long
value being pointed to
public float getFloat(long offset)
Indirect the native pointer as a pointer to float
. This is equivalent to the expression *((jfloat *)((char *)Pointer + offset))
.
offset
- byte offset from pointer to perform the indirection
float
value being pointed to
public double getDouble(long offset)
Indirect the native pointer as a pointer to double
. This is equivalent to the expression *((jdouble *)((char *)Pointer + offset))
.
offset
- byte offset from pointer to perform the indirection
double
value being pointed to
Indirect the native pointer as a pointer to pointer. This is equivalent to the expression *((void **)((char *)Pointer + offset))
.
offset
- byte offset from pointer to perform the indirection
Pointer
equivalent of the pointer value being pointed to, or null
if the pointer value is NULL
;
Get a ByteBuffer mapped to the memory pointed to by the pointer, ensuring the buffer uses native byte order.
offset
- byte offset from pointer to start the buffer
length
- Length of ByteBuffer
Read a wide (const wchar_t *
) string from memory.
offset
- byte offset from pointer to start reading bytes
String
value being pointed to
Copy native memory to a Java String using the requested encoding.
offset
- byte offset from pointer to obtain the native string
encoding
- the desired encoding
String
value being pointed to
public byte[] getByteArray(long offset, int arraySize)
Read a native array of bytes of size
arraySize
from the given
offset
from this
Pointer
.
public char[] getCharArray(long offset, int arraySize)
Read a native array of wchar_t of size
arraySize
from the given
offset
from this
Pointer
.
public short[] getShortArray(long offset, int arraySize)
Read a native array of int16 of size
arraySize
from the given
offset
from this
Pointer
.
public int[] getIntArray(long offset, int arraySize)
Read a native array of int32 of size
arraySize
from the given
offset
from this
Pointer
.
public long[] getLongArray(long offset, int arraySize)
Read a native array of int64 of size
arraySize
from the given
offset
from this
Pointer
.
public float[] getFloatArray(long offset, int arraySize)
Read a native array of float of size
arraySize
from the given
offset
from this
Pointer
.
public double[] getDoubleArray(long offset, int arraySize)
Read a native array of double of size
arraySize
from the given
offset
from this
Pointer
.
Returns an array of
Pointer
. The array length is determined by a NULL-valued terminating element.
Returns an array of
Pointer
of the requested size.
Returns an array of String
based on a native array of char *
. The array length is determined by a NULL-valued terminating element.
The strings are decoded using the encoding returned by
Native.getDefaultStringEncoding()
.
Returns an array of String
based on a native array of char *
, using the requested encoding. The array length is determined by a NULL-valued terminating element.
Returns an array of String
based on a native array of char *
, using the given array length.
The strings are decoded using the encoding returned by
Native.getDefaultStringEncoding()
.
Returns an array of String
based on a native array of char*
or wchar_t*
based on the wide
parameter, using the given array length.
offset
-
length
-
encoding
-
public void setMemory(long offset, long length, byte value)
Write value
to the requested bank of memory.
offset
- byte offset from pointer to start
length
- number of bytes to write
value
- value to be written
public void setByte(long offset, byte value)
Set value
at location being pointed to. This is equivalent to the expression *((jbyte *)((char *)Pointer + offset)) = value
.
offset
- byte offset from pointer at which value
must be set
value
- byte
value to set
public void setShort(long offset, short value)
Set value
at location being pointed to. This is equivalent to the expression *((jshort *)((char *)Pointer + offset)) = value
.
offset
- byte offset from pointer at which value
must be set
value
- short
value to set
public void setChar(long offset, char value)
Set value
at location being pointed to. This is equivalent to the expression *((wchar_t *)((char *)Pointer + offset)) = value
.
offset
- byte offset from pointer at which value
must be set
value
- char
value to set
public void setInt(long offset, int value)
Set value
at location being pointed to. This is equivalent to the expression *((jint *)((char *)Pointer + offset)) = value
.
offset
- byte offset from pointer at which value
must be set
value
- int
value to set
public void setLong(long offset, long value)
Set value
at location being pointed to. This is equivalent to the expression *((jlong *)((char *)Pointer + offset)) = value
.
offset
- byte offset from pointer at which value
must be set
value
- long
value to set
Set value
at location being pointed to. This is equivalent to the expression *((long *)((char *)Pointer + offset)) = value
.
offset
- byte offset from pointer at which value
must be set
value
- long
value to set
public void setFloat(long offset, float value)
Set value
at location being pointed to. This is equivalent to the expression *((jfloat *)((char *)Pointer + offset)) = value
.
offset
- byte offset from pointer at which value
must be set
value
- float
value to set
public void setDouble(long offset, double value)
Set value
at location being pointed to. This is equivalent to the expression *((jdouble *)((char *)Pointer + offset)) = value
.
offset
- byte offset from pointer at which value
must be set
value
- double
value to set
Set value
at location being pointed to. This is equivalent to the expression *((void **)((char *)Pointer + offset)) = value
.
offset
- byte offset from pointer at which value
must be set
value
- Pointer
holding the actual pointer value to set, which may be null
to indicate a NULL
pointer.
Copy string value
to the location being pointed to as a wide string (wchar_t*
).
offset
- byte offset from pointer at which characters in value
must be set
value
- java.lang.String
value to set
Copy string value
to the location being pointed to as a wide string (wchar_t*
).
offset
- byte offset from pointer at which characters in value
must be set
value
- WString
value to set
offset
- byte offset from pointer at which characters in value
must be set
value
- java.lang.String
value to set
Copy string value
to the location being pointed to, using the requested encoding.
offset
- byte offset from pointer at which characters in value
must be set
value
- java.lang.String
value to set
encoding
- desired encoding
Dump memory for debugging purposes.
Read the native peer value. Use with caution.
Set the native peer value. Use with caution.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4