Code example for Stack

Methods: add, lastElement

0
    } 
 
    /** Duplicates the top item on the stack */ 
    private void opDup() { 
        log.debug("DUP"); 
        stack.add(Arrays.clone(stack.lastElement()));
    } 
 
    ////////////////////// Interface for writing scripts from scratch //////////////////////////////// 
 
    /** Writes out the given byte buffer to the output stream with the correct opcode prefix */ 
    static void writeBytes(OutputStream os,  byte[] buf) throws IOException {
        if (buf.length < OP_PUSHDATA1) {
            os.write(buf.length);
            os.write(buf);
        } else if (buf.length < 256) {
            os.write(OP_PUSHDATA1);
            os.write(buf.length);
            os.write(buf);
        } else if (buf.length < 65536) {
            os.write(OP_PUSHDATA2);