-
- All Known Implementing Classes:
JnhwMemoryAccessor,UnsafeMemoryAccessor,UnsafeMemoryAccessor_P32_L32,UnsafeMemoryAccessor_P32_L64,UnsafeMemoryAccessor_P64_L32,UnsafeMemoryAccessor_P64_L64
public interface MemoryAccessor- Author:
- aploese
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description longallocateMemory(AbstractNativeMemory mem, long sizeInBytes)voidcopyMemory32(byte[] src, int srcPos, OpaqueMemory32 destMem, int destPos, int length)voidcopyMemory32(OpaqueMemory32 srcMem, int srcPos, byte[] dest, int destPos, int length)voidcopyMemory64(byte[] src, int srcPos, OpaqueMemory64 destMem, long destPos, int length)voidcopyMemory64(OpaqueMemory64 srcMem, long srcPos, byte[] dest, int destPos, int length)static booleangetBitInInt(int value, int bitpos)static bytegetBitsInByte(byte value, int bitpos, int bitsize)static intgetBitsInInt(int value, int bitpos, int bitsize)static longgetBitsInLong(long value, int bitpos, int bitsize)static shortgetBitsInShort(short value, int bitpos, int bitsize)default intgetSignedIntOf(OpaqueMemory32 mem, long offset, int realSize)default StringgetSignedIntOf_AsHex(OpaqueMemory32 mem, long offset, int realSize)default StringgetSignedIntOf_nativeToString(OpaqueMemory32 mem, long offset, int realSize)default longgetSignedLongOf(OpaqueMemory32 mem, long offset, int realSize)Read any native mem, offset with tes size realsize and cast the result to long. so if realSize is 4, it will read 4 bytes (int32_t) and cast the result to long.default StringgetSignedLongOf_AsHex(OpaqueMemory32 mem, long offset, int realSize)default StringgetSignedLongOf_nativeToString(OpaqueMemory32 mem, long offset, int realSize)StringgetUnicodeString(OpaqueMemory32 mem, long offset, int start, int len)intgetUnicodeStringLength(String s)underlying datatype is 16 bit wide, so multiply this by 2 for bytes needed!default intgetUnsignedIntOf(OpaqueMemory32 mem, long offset, int realSize)Read any native mem, offset with tes size realsize and cast the result to long. so if realSize is 4, it will read 4 bytes (uint32_t) and cast the result to long.default StringgetUnsignedIntOf_AsHex(OpaqueMemory32 mem, long offset, int realSize)default StringgetUnsignedIntOf_nativeToString(OpaqueMemory32 mem, long offset, int realSize)default longgetUnsignedLongOf(OpaqueMemory32 mem, long offset, int realSize)Read any native mem, offset with tes size realsize and cast the result to long. so if realSize is 4, it will read 4 bytes (uint32_t) and cast the result to long.default StringgetUnsignedLongOf_AsHex(OpaqueMemory32 mem, long offset, int realSize)default StringgetUnsignedLongOf_nativeToString(OpaqueMemory32 mem, long offset, int realSize)StringgetUTF_8String(OpaqueMemory32 mem, long offset)this is a NULL terminated string, so we have to fetch the complete string.intgetUTF_8StringLength(String s)In order to calculate the needed size in bytes, add a 1 for NULL termination!shortint16_t(OpaqueMemory32 mem, long offset)voidint16_t(OpaqueMemory32 mem, long offset, short value)Stringint16_t_AsHex(OpaqueMemory32 mem, long offset)Stringint16_t_nativeToString(OpaqueMemory32 mem, long offset)intint32_t(OpaqueMemory32 mem, long offset)voidint32_t(OpaqueMemory32 mem, long offset, int value)Stringint32_t_AsHex(OpaqueMemory32 mem, long offset)Stringint32_t_nativeToString(OpaqueMemory32 mem, long offset)longint64_t(OpaqueMemory32 mem, long offset)voidint64_t(OpaqueMemory32 mem, long offset, long value)Stringint64_t_AsHex(OpaqueMemory32 mem, long offset)Stringint64_t_nativeToString(OpaqueMemory32 mem, long offset)byteint8_t(OpaqueMemory32 mem, long offset)voidint8_t(OpaqueMemory32 mem, long offset, byte value)byteint8_t(OpaqueMemory64 mem, long offset)voidint8_t(OpaqueMemory64 mem, long offset, byte value)Stringint8_t_AsHex(OpaqueMemory32 mem, long offset)Stringint8_t_nativeToString(OpaqueMemory32 mem, long offset)longintptr_t(OpaqueMemory32 mem, long offset)voidintptr_t(OpaqueMemory32 mem, long offset, long dest)Stringintptr_t_AsHex(OpaqueMemory32 mem, long offset)longintptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index)voidintptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index, long dest)static voidoutOfBoundsByteArray(int pos, int len, int arrayLength)static voidoutOfBoundsMem(long pos, long len, long memLength)static intsetBitInInt(int value, int bitpos, boolean bit)static bytesetBitsInByte(byte value, int bitpos, int bitsize, byte bitsToSet)static intsetBitsInInt(int value, int bitpos, int bitsize, int bitsToSet)static longsetBitsInLong(long value, int bitpos, int bitsize, long bitsToSet)static shortsetBitsInShort(short value, int bitpos, int bitsize, short bitsToSet)voidsetMemory32(OpaqueMemory32 mem, byte value)voidsetMemory64(OpaqueMemory64 mem, byte value)default voidsetSignedIntOf(OpaqueMemory32 mem, long offset, int realSize, int value)default voidsetSignedLongOf(OpaqueMemory32 mem, long offset, int realSize, long value)voidsetUnicodeString(String s, int srcStart, OpaqueMemory32 mem, long offset, int destStart, int len)default voidsetUnsignedIntOf(OpaqueMemory32 mem, long offset, int realSize, int value)default voidsetUnsignedLongOf(OpaqueMemory32 mem, long offset, int realSize, long value)voidsetUTF_8String(String s, int srcStart, OpaqueMemory32 mem, long offset, int len)longsigned_long(OpaqueMemory32 mem, long offset)access the native long (signed long) datatype.voidsigned_long(OpaqueMemory32 mem, long offset, long value)access the native long (signed long) datatype.longsigned_long_AtIndex(OpaqueMemory32 mem, long offset, int index)access the ith native unsigned long datatype.voidsigned_long_AtIndex(OpaqueMemory32 mem, long offset, int index, long value)access the ith native unsigned long datatype.shortuint16_t(OpaqueMemory32 mem, long offset)voiduint16_t(OpaqueMemory32 mem, long offset, short value)Stringuint16_t_AsHex(OpaqueMemory32 mem, long offset)intuint16_t_AsInt(OpaqueMemory32 mem, long offset)voiduint16_t_FromInt(OpaqueMemory32 mem, long offset, int value)Stringuint16_t_nativeToString(OpaqueMemory32 mem, long offset)intuint32_t(OpaqueMemory32 mem, long offset)voiduint32_t(OpaqueMemory32 mem, long offset, int value)Stringuint32_t_AsHex(OpaqueMemory32 mem, long offset)longuint32_t_AsLong(OpaqueMemory32 mem, long offset)voiduint32_t_FromLong(OpaqueMemory32 mem, long offset, long value)Stringuint32_t_nativeToString(OpaqueMemory32 mem, long offset)longuint64_t(OpaqueMemory32 mem, long offset)voiduint64_t(OpaqueMemory32 mem, long offset, long value)Stringuint64_t_AsHex(OpaqueMemory32 mem, long offset)Stringuint64_t_nativeToString(OpaqueMemory32 mem, long offset)byteuint8_t(OpaqueMemory32 mem, long offset)voiduint8_t(OpaqueMemory32 mem, long offset, byte value)Stringuint8_t_AsHex(OpaqueMemory32 mem, long offset)shortuint8_t_AsShort(OpaqueMemory32 mem, long offset)voiduint8_t_FromShort(OpaqueMemory32 mem, long offset, short value)Stringuint8_t_nativeToString(OpaqueMemory32 mem, long offset)longuintptr_t(OpaqueMemory32 mem, long offset)voiduintptr_t(OpaqueMemory32 mem, long offset, long dest)voiduintptr_t(OpaqueMemory32 mem, long offset, NativeAddressHolder dest)voiduintptr_t(OpaqueMemory32 mem, long offset, NativeFunctionPointer dest)voiduintptr_t(OpaqueMemory32 mem, long offset, OpaqueMemory32 dest)voiduintptr_t(OpaqueMemory32 mem, long offset, OpaqueMemory32 dest, long destOffset)voiduintptr_t(OpaqueMemory32 mem, long offset, ByteBuffer dest)Stringuintptr_t_AsHex(OpaqueMemory32 mem, long offset)NativeAddressHolderuintptr_t_AsNativeAddressHolder(OpaqueMemory32 mem, long offset)longuintptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index)voiduintptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index, long dest)voiduintptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index, NativeAddressHolder dest)voiduintptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index, OpaqueMemory32 dest)NativeAddressHolderuintptr_t_AtIndex_AsNativeAddressHolder(OpaqueMemory32 mem, long offset, int index)longunsigned_long(OpaqueMemory32 mem, long offset)access the native unsigned long datatype.voidunsigned_long(OpaqueMemory32 mem, long offset, long value)access the native unsigned long datatype.longunsigned_long_AtIndex(OpaqueMemory32 mem, long offset, int index)access the ith native unsigned long datatype.voidunsigned_long_AtIndex(OpaqueMemory32 mem, long offset, int index, long value)access the ith native unsigned long datatype.
-
-
-
Method Detail
-
outOfBoundsByteArray
static void outOfBoundsByteArray(int pos, int len, int arrayLength)- Parameters:
pos- a position with in the arraylen- a lengtharrayLength- th length of the array- Throws:
ArrayIndexOutOfBoundsException- if pos or len < 0 or pos + len > arrayLength
-
outOfBoundsMem
static void outOfBoundsMem(long pos, long len, long memLength)
-
int8_t
byte int8_t(OpaqueMemory32 mem, long offset)
-
int8_t
void int8_t(OpaqueMemory32 mem, long offset, byte value)
-
int8_t
byte int8_t(OpaqueMemory64 mem, long offset)
-
int8_t
void int8_t(OpaqueMemory64 mem, long offset, byte value)
-
int8_t_AsHex
String int8_t_AsHex(OpaqueMemory32 mem, long offset)
-
int8_t_nativeToString
String int8_t_nativeToString(OpaqueMemory32 mem, long offset)
-
int16_t
short int16_t(OpaqueMemory32 mem, long offset)
-
int16_t
void int16_t(OpaqueMemory32 mem, long offset, short value)
-
int16_t_AsHex
String int16_t_AsHex(OpaqueMemory32 mem, long offset)
-
int16_t_nativeToString
String int16_t_nativeToString(OpaqueMemory32 mem, long offset)
-
int32_t
int int32_t(OpaqueMemory32 mem, long offset)
-
int32_t
void int32_t(OpaqueMemory32 mem, long offset, int value)
-
int32_t_AsHex
String int32_t_AsHex(OpaqueMemory32 mem, long offset)
-
int32_t_nativeToString
String int32_t_nativeToString(OpaqueMemory32 mem, long offset)
-
int64_t
long int64_t(OpaqueMemory32 mem, long offset)
-
int64_t
void int64_t(OpaqueMemory32 mem, long offset, long value)
-
int64_t_AsHex
String int64_t_AsHex(OpaqueMemory32 mem, long offset)
-
int64_t_nativeToString
String int64_t_nativeToString(OpaqueMemory32 mem, long offset)
-
uint8_t
byte uint8_t(OpaqueMemory32 mem, long offset)
-
uint8_t_AsShort
short uint8_t_AsShort(OpaqueMemory32 mem, long offset)
-
uint8_t
void uint8_t(OpaqueMemory32 mem, long offset, byte value)
-
uint8_t_FromShort
void uint8_t_FromShort(OpaqueMemory32 mem, long offset, short value)
-
uint8_t_AsHex
String uint8_t_AsHex(OpaqueMemory32 mem, long offset)
-
uint8_t_nativeToString
String uint8_t_nativeToString(OpaqueMemory32 mem, long offset)
-
uint16_t
short uint16_t(OpaqueMemory32 mem, long offset)
-
uint16_t_AsInt
int uint16_t_AsInt(OpaqueMemory32 mem, long offset)
-
uint16_t
void uint16_t(OpaqueMemory32 mem, long offset, short value)
-
uint16_t_FromInt
void uint16_t_FromInt(OpaqueMemory32 mem, long offset, int value)
-
uint16_t_AsHex
String uint16_t_AsHex(OpaqueMemory32 mem, long offset)
-
uint16_t_nativeToString
String uint16_t_nativeToString(OpaqueMemory32 mem, long offset)
-
uint32_t
int uint32_t(OpaqueMemory32 mem, long offset)
-
uint32_t_AsLong
long uint32_t_AsLong(OpaqueMemory32 mem, long offset)
-
uint32_t
void uint32_t(OpaqueMemory32 mem, long offset, int value)
-
uint32_t_FromLong
void uint32_t_FromLong(OpaqueMemory32 mem, long offset, long value)
-
uint32_t_AsHex
String uint32_t_AsHex(OpaqueMemory32 mem, long offset)
-
uint32_t_nativeToString
String uint32_t_nativeToString(OpaqueMemory32 mem, long offset)
-
signed_long
long signed_long(OpaqueMemory32 mem, long offset)
access the native long (signed long) datatype. It m,ay be 32 or 64bis- Parameters:
mem-offset-- Returns:
-
signed_long
void signed_long(OpaqueMemory32 mem, long offset, long value)
access the native long (signed long) datatype. It m,ay be 32 or 64bis- Parameters:
mem-offset-
-
signed_long_AtIndex
long signed_long_AtIndex(OpaqueMemory32 mem, long offset, int index)
access the ith native unsigned long datatype. It m,ay be 32 or 64bis- Parameters:
mem-offset-
-
signed_long_AtIndex
void signed_long_AtIndex(OpaqueMemory32 mem, long offset, int index, long value)
access the ith native unsigned long datatype. It m,ay be 32 or 64bis- Parameters:
mem-offset-
-
unsigned_long
long unsigned_long(OpaqueMemory32 mem, long offset)
access the native unsigned long datatype. It m,ay be 32 or 64bis- Parameters:
mem-offset-- Returns:
-
unsigned_long
void unsigned_long(OpaqueMemory32 mem, long offset, long value)
access the native unsigned long datatype. It m,ay be 32 or 64bis- Parameters:
mem-offset-
-
unsigned_long_AtIndex
long unsigned_long_AtIndex(OpaqueMemory32 mem, long offset, int index)
access the ith native unsigned long datatype. It m,ay be 32 or 64bis- Parameters:
mem-offset-
-
unsigned_long_AtIndex
void unsigned_long_AtIndex(OpaqueMemory32 mem, long offset, int index, long value)
access the ith native unsigned long datatype. It m,ay be 32 or 64bis- Parameters:
mem-offset-
-
uint64_t
long uint64_t(OpaqueMemory32 mem, long offset)
-
uint64_t
void uint64_t(OpaqueMemory32 mem, long offset, long value)
-
uint64_t_AsHex
String uint64_t_AsHex(OpaqueMemory32 mem, long offset)
-
uint64_t_nativeToString
String uint64_t_nativeToString(OpaqueMemory32 mem, long offset)
-
getSignedIntOf
default int getSignedIntOf(OpaqueMemory32 mem, long offset, int realSize)
-
setSignedIntOf
default void setSignedIntOf(OpaqueMemory32 mem, long offset, int realSize, int value)
-
setUnsignedIntOf
default void setUnsignedIntOf(OpaqueMemory32 mem, long offset, int realSize, int value)
-
getUnsignedIntOf
default int getUnsignedIntOf(OpaqueMemory32 mem, long offset, int realSize)
Read any native mem, offset with tes size realsize and cast the result to long. so if realSize is 4, it will read 4 bytes (uint32_t) and cast the result to long. The conversation of unsigned applys from uint8_t->short,uint16_t->int, uint32_t->long. uint_64 is a long the signedness must be hancled someplace else.- Parameters:
mem- , offsetrealSize-- Returns:
-
getUnsignedIntOf_AsHex
default String getUnsignedIntOf_AsHex(OpaqueMemory32 mem, long offset, int realSize)
-
getSignedIntOf_AsHex
default String getSignedIntOf_AsHex(OpaqueMemory32 mem, long offset, int realSize)
-
getUnsignedIntOf_nativeToString
default String getUnsignedIntOf_nativeToString(OpaqueMemory32 mem, long offset, int realSize)
-
getSignedIntOf_nativeToString
default String getSignedIntOf_nativeToString(OpaqueMemory32 mem, long offset, int realSize)
-
getSignedLongOf
default long getSignedLongOf(OpaqueMemory32 mem, long offset, int realSize)
Read any native mem, offset with tes size realsize and cast the result to long. so if realSize is 4, it will read 4 bytes (int32_t) and cast the result to long.- Parameters:
mem- , offset the mem, offset to read fromrealSize- the real byte size of the data this happens on 32/64 archs in 32 its 4 byte and on 64 8 byte long- Returns:
-
setSignedLongOf
default void setSignedLongOf(OpaqueMemory32 mem, long offset, int realSize, long value)
-
setUnsignedLongOf
default void setUnsignedLongOf(OpaqueMemory32 mem, long offset, int realSize, long value)
-
getUnsignedLongOf
default long getUnsignedLongOf(OpaqueMemory32 mem, long offset, int realSize)
Read any native mem, offset with tes size realsize and cast the result to long. so if realSize is 4, it will read 4 bytes (uint32_t) and cast the result to long. The conversation of unsigned applys from uint8_t->short,uint16_t->int, uint32_t->long. uint_64 is a long the signedness must be hancled someplace else.- Parameters:
mem- , offsetrealSize-- Returns:
-
getUnsignedLongOf_AsHex
default String getUnsignedLongOf_AsHex(OpaqueMemory32 mem, long offset, int realSize)
-
getSignedLongOf_AsHex
default String getSignedLongOf_AsHex(OpaqueMemory32 mem, long offset, int realSize)
-
getUnsignedLongOf_nativeToString
default String getUnsignedLongOf_nativeToString(OpaqueMemory32 mem, long offset, int realSize)
-
getSignedLongOf_nativeToString
default String getSignedLongOf_nativeToString(OpaqueMemory32 mem, long offset, int realSize)
-
allocateMemory
long allocateMemory(AbstractNativeMemory mem, long sizeInBytes)
-
setMemory32
void setMemory32(OpaqueMemory32 mem, byte value)
-
setMemory64
void setMemory64(OpaqueMemory64 mem, byte value)
-
copyMemory32
void copyMemory32(byte[] src, int srcPos, OpaqueMemory32 destMem, int destPos, int length)
-
copyMemory64
void copyMemory64(byte[] src, int srcPos, OpaqueMemory64 destMem, long destPos, int length)
-
copyMemory32
void copyMemory32(OpaqueMemory32 srcMem, int srcPos, byte[] dest, int destPos, int length)
-
copyMemory64
void copyMemory64(OpaqueMemory64 srcMem, long srcPos, byte[] dest, int destPos, int length)
-
intptr_t
long intptr_t(OpaqueMemory32 mem, long offset)
-
intptr_t
void intptr_t(OpaqueMemory32 mem, long offset, long dest)
-
intptr_t_AsHex
String intptr_t_AsHex(OpaqueMemory32 mem, long offset)
-
intptr_t_AtIndex
long intptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index)
-
intptr_t_AtIndex
void intptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index, long dest)
-
uintptr_t
long uintptr_t(OpaqueMemory32 mem, long offset)
-
uintptr_t_AsNativeAddressHolder
NativeAddressHolder uintptr_t_AsNativeAddressHolder(OpaqueMemory32 mem, long offset)
-
uintptr_t
void uintptr_t(OpaqueMemory32 mem, long offset, long dest)
-
uintptr_t
void uintptr_t(OpaqueMemory32 mem, long offset, OpaqueMemory32 dest)
-
uintptr_t
void uintptr_t(OpaqueMemory32 mem, long offset, OpaqueMemory32 dest, long destOffset)
-
uintptr_t
void uintptr_t(OpaqueMemory32 mem, long offset, ByteBuffer dest)
-
uintptr_t
void uintptr_t(OpaqueMemory32 mem, long offset, NativeAddressHolder dest)
-
uintptr_t
void uintptr_t(OpaqueMemory32 mem, long offset, NativeFunctionPointer dest)
-
uintptr_t_AsHex
String uintptr_t_AsHex(OpaqueMemory32 mem, long offset)
-
uintptr_t_AtIndex
long uintptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index)
-
uintptr_t_AtIndex_AsNativeAddressHolder
NativeAddressHolder uintptr_t_AtIndex_AsNativeAddressHolder(OpaqueMemory32 mem, long offset, int index)
-
uintptr_t_AtIndex
void uintptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index, long dest)
-
uintptr_t_AtIndex
void uintptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index, OpaqueMemory32 dest)
-
uintptr_t_AtIndex
void uintptr_t_AtIndex(OpaqueMemory32 mem, long offset, int index, NativeAddressHolder dest)
-
getUTF_8String
String getUTF_8String(OpaqueMemory32 mem, long offset)
this is a NULL terminated string, so we have to fetch the complete string.- Parameters:
mem-offset-- Returns:
-
setUTF_8String
void setUTF_8String(String s, int srcStart, OpaqueMemory32 mem, long offset, int len)
-
getUTF_8StringLength
int getUTF_8StringLength(String s)
In order to calculate the needed size in bytes, add a 1 for NULL termination!- Parameters:
s-- Returns:
-
getUnicodeString
String getUnicodeString(OpaqueMemory32 mem, long offset, int start, int len)
-
setUnicodeString
void setUnicodeString(String s, int srcStart, OpaqueMemory32 mem, long offset, int destStart, int len)
-
getUnicodeStringLength
int getUnicodeStringLength(String s)
underlying datatype is 16 bit wide, so multiply this by 2 for bytes needed! this will not be NULL terminated!- Parameters:
s-- Returns:
-
getBitsInLong
static long getBitsInLong(long value, int bitpos, int bitsize)
-
setBitsInLong
static long setBitsInLong(long value, int bitpos, int bitsize, long bitsToSet)
-
getBitInInt
static boolean getBitInInt(int value, int bitpos)
-
setBitInInt
static int setBitInInt(int value, int bitpos, boolean bit)
-
getBitsInInt
static int getBitsInInt(int value, int bitpos, int bitsize)
-
setBitsInInt
static int setBitsInInt(int value, int bitpos, int bitsize, int bitsToSet)
-
getBitsInShort
static short getBitsInShort(short value, int bitpos, int bitsize)
-
setBitsInShort
static short setBitsInShort(short value, int bitpos, int bitsize, short bitsToSet)
-
getBitsInByte
static byte getBitsInByte(byte value, int bitpos, int bitsize)
-
setBitsInByte
static byte setBitsInByte(byte value, int bitpos, int bitsize, byte bitsToSet)
-
-