View Javadoc
1 /* file name : Code.java 2 * authors : Christopher Ellsworth (Chris@chrisellsworth.com) 3 * created : 11/05/2002 02:33:06 4 * copyright : 5 * 6 * modifications: 7 * 8 */ 9 package jrre.classloader.classfile.attributes; 10 11 import jrre.classloader.classfile.InstructionDecoder; 12 import jrre.instructionset.Instruction; 13 14 15 /*** 16 * Contains byte-code from a <code>CodeAttribute</code> in 17 * a method info. 18 * 19 * @author Christopher Ellsworth (Chris@chrisellsworth.com) 20 */ 21 public class Code { 22 23 private int [] codeArray; 24 private Instruction firstInstruction; 25 26 public Code(){} 27 28 public Code(int [] codeArray) { 29 this.codeArray = codeArray; 30 // Not behaving correctly. 31 //Thread thread = new Thread(this); 32 //thread.start(); 33 //run(); 34 } 35 36 public int [] getByteCode() { 37 return codeArray; 38 } 39 40 /*** 41 * Gets a string representation of the byte-code. 42 * 43 * @return The byte-code. 44 */ 45 public String toString(){ 46 StringBuffer toReturn = new StringBuffer(); 47 48 toReturn.append("Byte Code: "); 49 for(int i=0;i < codeArray.length;i++) 50 toReturn.append("\n\t\t\t0x"+Integer.toHexString(codeArray[i])); 51 52 return toReturn.toString(); 53 } 54 55 /* 56 public void run(){ 57 58 firstInstruction = InstructionDecoder.decode(codeArray); 59 60 } 61 */ 62 63 }

This page was automatically generated by Maven