예제 #1
0
 /**
  * When everything is finished, use this method to convert the instruction list into an array of
  * bytes.
  *
  * @return the byte code ready to be dumped
  */
 public byte[] getByteCode() {
   // Update position indices of instructions
   setPositions();
   ByteArrayOutputStream b = new ByteArrayOutputStream();
   DataOutputStream out = new DataOutputStream(b);
   try {
     for (InstructionHandle ih = start; ih != null; ih = ih.next) {
       Instruction i = ih.instruction;
       i.dump(out); // Traverse list
     }
   } catch (IOException e) {
     System.err.println(e);
     return new byte[0];
   }
   return b.toByteArray();
 }
예제 #2
0
 public void setPositions() {
   setPositions(false);
 }