Interface MemoryAccessor

    • Method Detail

      • outOfBoundsByteArray

        static void outOfBoundsByteArray​(int pos,
                                         int len,
                                         int arrayLength)
        Parameters:
        pos - a position with in the array
        len - a length
        arrayLength - 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

        void int8_t​(OpaqueMemory32 mem,
                    long offset,
                    byte value)
      • int8_t

        void int8_t​(OpaqueMemory64 mem,
                    long offset,
                    byte value)
      • int16_t

        void int16_t​(OpaqueMemory32 mem,
                     long offset,
                     short value)
      • int32_t

        void int32_t​(OpaqueMemory32 mem,
                     long offset,
                     int value)
      • int64_t

        void int64_t​(OpaqueMemory32 mem,
                     long offset,
                     long value)
      • 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)
      • 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)
      • 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)
      • 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

        void uint64_t​(OpaqueMemory32 mem,
                      long offset,
                      long value)
      • 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 - , offset
        realSize -
        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 from
        realSize - 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 - , offset
        realSize -
        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)
      • 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

        void intptr_t​(OpaqueMemory32 mem,
                      long offset,
                      long dest)
      • 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

        void uintptr_t​(OpaqueMemory32 mem,
                       long offset,
                       long dest)
      • uintptr_t_AtIndex

        long uintptr_t_AtIndex​(OpaqueMemory32 mem,
                               long offset,
                               int index)
      • uintptr_t_AtIndex

        void uintptr_t_AtIndex​(OpaqueMemory32 mem,
                               long offset,
                               int index,
                               long 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)