com.ibm.dtfj.image
Interface ImagePointer


public interface ImagePointer

Represents an address in image memory.

Author:
pburka

Method Summary
 ImagePointer add(long offset)
          Build a new image pointer offset from this one by the given amount.
 boolean equals(java.lang.Object obj)
           
 long getAddress()
          Get the unwrapped address, represented as a 64-bit integer.
 ImageAddressSpace getAddressSpace()
          Get the address space to which this pointer belongs.
 byte getByteAt(long index)
          Get the value at the given offset from this pointer.
 double getDoubleAt(long index)
          Get the value at the given offset from this pointer.
 float getFloatAt(long index)
          Get the value at the given offset from this pointer.
 int getIntAt(long index)
          Get the value at the given offset from this pointer.
 long getLongAt(long index)
          Get the value at the given offset from this pointer.
 ImagePointer getPointerAt(long index)
          Get the value at the given offset from this pointer.
 short getShortAt(long index)
          Get the value at the given offset from this pointer.
 int hashCode()
           
 boolean isExecutable()
          Is the referenced location executable ?
 boolean isReadOnly()
          Is the referenced location read only ?
 boolean isShared()
          Is the referenced location shared ?
 

Method Detail

getAddress

long getAddress()
Get the unwrapped address, represented as a 64-bit integer.

Returns:
the unwrapped address, represented as a 64-bit integer
Use caution when comparing addresses, as some addresses may be negative.
Note that on segmented memory architectures, it may not be possible to represent all addresses accurately as integers

getAddressSpace

ImageAddressSpace getAddressSpace()
Get the address space to which this pointer belongs.

Returns:
the address space to which this pointer belongs

add

ImagePointer add(long offset)
Build a new image pointer offset from this one by the given amount.

Parameters:
offset -
Returns:
a new ImagePointer based at getAddress() + offset

isExecutable

boolean isExecutable()
                     throws DataUnavailable
Is the referenced location executable ?

Returns:
true if this memory address is within an executable page
Throws:
DataUnavailable

isReadOnly

boolean isReadOnly()
                   throws DataUnavailable
Is the referenced location read only ?

Returns:
true if write access to this memory address was disabled in the image
Throws:
DataUnavailable

isShared

boolean isShared()
                 throws DataUnavailable
Is the referenced location shared ?

Returns:
true if this memory address is shared between processes
Throws:
DataUnavailable

getPointerAt

ImagePointer getPointerAt(long index)
                          throws MemoryAccessException,
                                 CorruptDataException
Get the value at the given offset from this pointer.

Parameters:
index - an offset from the current position
Returns:
the 32 or 64-bit pointer stored at getAddress() + index * sizeof(void*)
Throws:
MemoryAccessException - if the memory cannot be read
CorruptDataException - if the memory should be in the image, but is missing or corrupted

getLongAt

long getLongAt(long index)
               throws MemoryAccessException,
                      CorruptDataException
Get the value at the given offset from this pointer.

Parameters:
index - an offset from the current position
Returns:
the 64-bit long stored at getAddress() + index * sizeof(jlong)
Throws:
MemoryAccessException - if the memory cannot be read
CorruptDataException - if the memory should be in the image, but is missing or corrupted

getIntAt

int getIntAt(long index)
             throws MemoryAccessException,
                    CorruptDataException
Get the value at the given offset from this pointer.

Parameters:
index - an offset from the current position
Returns:
the 32-bit int stored at getAddress() + index * sizeof(jint)
Throws:
MemoryAccessException - if the memory cannot be read
CorruptDataException - if the memory should be in the image, but is missing or corrupted

getShortAt

short getShortAt(long index)
                 throws MemoryAccessException,
                        CorruptDataException
Get the value at the given offset from this pointer.

Parameters:
index - an offset from the current position
Returns:
the 16-bit short stored at getAddress() + index * sizeof(jshort)
Throws:
MemoryAccessException - if the memory cannot be read
CorruptDataException - if the memory should be in the image, but is missing or corrupted

getByteAt

byte getByteAt(long index)
               throws MemoryAccessException,
                      CorruptDataException
Get the value at the given offset from this pointer.

Parameters:
index - an offset from the current position
Returns:
the 8-bit byte stored at getAddress() + index * sizeof(jbyte)
Throws:
MemoryAccessException - if the memory cannot be read
CorruptDataException - if the memory should be in the image, but is missing or corrupted

getFloatAt

float getFloatAt(long index)
                 throws MemoryAccessException,
                        CorruptDataException
Get the value at the given offset from this pointer.

Parameters:
index - an offset from the current position
Returns:
the 32-bit float stored at getAddress() + index * sizeof(jfloat)
Throws:
MemoryAccessException - if the memory cannot be read
CorruptDataException - if the memory should be in the image, but is missing or corrupted

getDoubleAt

double getDoubleAt(long index)
                   throws MemoryAccessException,
                          CorruptDataException
Get the value at the given offset from this pointer.

Parameters:
index - an offset from the current position
Returns:
the 64-bit double stored at getAddress() + index * sizeof(jdouble)
Throws:
MemoryAccessException - if the memory cannot be read
CorruptDataException - if the memory should be in the image, but is missing or corrupted

equals

boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
Parameters:
obj -
Returns:
True obj refers to the same Image Pointer in the image

hashCode

int hashCode()
Overrides:
hashCode in class java.lang.Object