/** * Dump instruction as short code to stream out. */ @Override public void dump( final DataOutputStream out ) throws IOException { super.dump(out); out.writeShort(b); }
/** * Dump instruction as byte code to stream out. */ @Override public void dump( final DataOutputStream out ) throws IOException { super.dump(out); out.writeByte(b); }
/** * Dump instruction as short code to stream out. */ public void dump(DataOutputStream out) throws IOException { super.dump(out); out.writeShort(b); }
/** * Dump instruction as byte code to stream out. */ public void dump(DataOutputStream out) throws IOException { super.dump(out); out.writeByte(b); }
/** * 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 null; } return b.toByteArray(); }
/** * 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(); final ByteArrayOutputStream b = new ByteArrayOutputStream(); final DataOutputStream out = new DataOutputStream(b); try { for (InstructionHandle ih = start; ih != null; ih = ih.getNext()) { final Instruction i = ih.getInstruction(); i.dump(out); // Traverse list } out.flush(); } catch (final IOException e) { System.err.println(e); return new byte[0]; } return b.toByteArray(); }