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

BIPUSH.java

00001 package de.fub.bytecode.generic;
00002 
00003 import java.io.*;
00004 import de.fub.bytecode.util.ByteSequence;
00005 
00006 /** 
00007  * BIPUSH - Push byte
00008  *
00009  * <PRE>Stack: ... -&gt; ..., value</PRE>
00010  *
00011  * @version $Id: BIPUSH.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 BIPUSH extends Instruction implements ConstantPushInstruction {
00015   private byte b;
00016 
00017   /**
00018    * Empty constructor needed for the Class.newInstance() statement in
00019    * Instruction.readInstruction(). Not to be used otherwise.
00020    */
00021   BIPUSH() {}  
00022   public BIPUSH(byte b) {
00023     super(BIPUSH, (short)2);
00024     this.b = b;
00025   }  
00026   /**
00027    * Dump instruction as byte code to stream out.
00028    */
00029   public void dump(DataOutputStream out) throws IOException {
00030     super.dump(out);
00031     out.writeByte(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 = 2;
00040     b      = bytes.readByte();
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:40:43 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001