Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SIPUSH.java

00001 package de.fub.bytecode.generic;
00002 
00003 import java.io.*;
00004 import de.fub.bytecode.util.ByteSequence;
00005 
00006 /**
00007  * SIPUSH - Push short
00008  *
00009  * <PRE>Stack: ... -&gt; ..., value</PRE>
00010  *
00011  * @version $Id: SIPUSH.java,v 1.1.1.1 2002/01/24 03:44:05 pserver Exp $
00012  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00013  */
00014 public class SIPUSH extends Instruction implements ConstantPushInstruction {
00015   private short b;
00016 
00017   /**
00018    * Empty constructor needed for the Class.newInstance() statement in
00019    * Instruction.readInstruction(). Not to be used otherwise.
00020    */
00021   SIPUSH() {}  
00022   public SIPUSH(short b) {
00023     super(SIPUSH, (short)3);
00024     this.b = b;
00025   }  
00026   /**
00027    * Dump instruction as short code to stream out.
00028    */
00029   public void dump(DataOutputStream out) throws IOException {
00030     super.dump(out);
00031     out.writeShort(b);
00032   }  
00033   public Number getValue() { return new Integer(b); }  
00034   /**
00035    * Read needed data (e.g. index) from file.
00036    */
00037   protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException
00038   {
00039     length = 3;
00040     b      = bytes.readShort();
00041   }  
00042   /**
00043    * @return mnemonic for instruction
00044    */
00045   public String toString(boolean verbose) {
00046     return super.toString(verbose) + " " + b;
00047   }  
00048 }

Generated at Thu Feb 7 06:54:56 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001