out.error("Specified length is invalid");
return;
}
}
ImagePointer imagePointerBase = imageAddressSpace.getPointer(addressInDecimal);
String asciiChars = "";
long i;
for (i = 0; i < numBytesToPrint; i++){
ImagePointer imagePointer = imagePointerBase.add(i);
//stringBuffer.append(Long.toHexString(addressInDecimal+i)+":\t");
//stringBuffer.append(Long.toHexString(imagePointer.getAddress())+":\t");
try {
Byte byteValue = new Byte(imagePointer.getByteAt(0));
asciiIndex = (int) byteValue.byteValue();
if (asciiIndex < 0) {
asciiIndex += 256;
}
String rawHexString = Integer.toHexString(byteValue.intValue());
String fixedHexString = fixHexStringLength(rawHexString);
String hexText = fixedHexString;
if (0 == i%4){
hexText = " "+hexText;
}
if (0 == i%16){
hexText = "\n"+Long.toHexString(imagePointer.getAddress())+":"+hexText;
asciiChars = " |";
}
stringBuffer.append(hexText);
asciiChars += Utils.byteToAscii.substring(asciiIndex,asciiIndex+1);
if (15 == i%16 && i != 0){
asciiChars += "|";
//System.out.println("****"+asciiChars);
stringBuffer.append(asciiChars);
}
}catch (MemoryAccessException e) {
out.error("Address not in memory - 0x"
+ Long.toHexString(imagePointer.getAddress()));
return;
}catch (CorruptDataException e) {
out.error("Dump data is corrupted");
return;
}