java.lang.Object
com.ibm.dtfj.corereaders.j9.Memory
Memory adapter which removes the need for a component to know the address space ID that it is working with.
This is set when the adapter is created.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Identify the memory as 32 or 64 bitlong
findPattern
(byte[] whatBytes, int alignment, long startFrom) Search the memory for a specific byte patternbyte
getByteAt
(long address) Read a byte from the specified addressint
getBytesAt
(long address, byte[] buffer) Read a byte from the specified addressint
getIntAt
(long address) Read an int from the specified addresslong
getLongAt
(long address) Read a long from the specified addressbyte[]
getMemoryBytes
(long address, int size) Read bytes from the specified addressGet the memory ranges for this address spacelong
getPointerAt
(long address) Read a pointer at the specified addressshort
getShortAt
(long address) Read a short from the specified addressboolean
isExecutable
(long address) Flag for executable memoryboolean
isReadOnly
(long address) Flag to indicate if the memory is read onlyboolean
isShared
(long address) Flag to indicate if the memory is shared
-
Constructor Details
-
Memory
Create a memory representation- Parameters:
space
- the underlying address space
-
-
Method Details
-
bytesPerPointer
public int bytesPerPointer()Identify the memory as 32 or 64 bit- Returns:
- 4 for 31/32 bit, 8 for 64 bit
-
findPattern
public long findPattern(byte[] whatBytes, int alignment, long startFrom) Search the memory for a specific byte pattern- Parameters:
whatBytes
- what to search foralignment
- byte alignmentstartFrom
- position to start the search from- Returns:
- the address of the bytes if found or -1
-
getByteAt
Read a byte from the specified address- Parameters:
address
- address to read from- Returns:
- the data
- Throws:
MemoryAccessException
-
getBytesAt
Read a byte from the specified address- Parameters:
address
- address to read from- Returns:
- the data
- Throws:
MemoryAccessException
-
getIntAt
Read an int from the specified address- Parameters:
address
- address to read from- Returns:
- the data
- Throws:
MemoryAccessException
-
getLongAt
Read a long from the specified address- Parameters:
address
- address to read from- Returns:
- the data
- Throws:
MemoryAccessException
-
getMemoryBytes
public byte[] getMemoryBytes(long address, int size) Read bytes from the specified address- Parameters:
address
- address to read fromsize
- number of bytes to read- Returns:
- the data
-
getMemoryRanges
Get the memory ranges for this address space -
getPointerAt
Read a pointer at the specified address- Parameters:
address
- address to read from- Returns:
- the data
- Throws:
MemoryAccessException
-
getShortAt
Read a short from the specified address- Parameters:
address
- address to read from- Returns:
- the data
- Throws:
MemoryAccessException
-
isExecutable
Flag for executable memory- Returns:
- true if it is executable
- Throws:
MemoryAccessException
-
isReadOnly
Flag to indicate if the memory is read only- Returns:
- true if it is read only
- Throws:
MemoryAccessException
-