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

ConstantLong.java

00001 package de.fub.bytecode.classfile;
00002 
00003 import  de.fub.bytecode.Constants;
00004 import  java.io.*;
00005 
00006 /** 
00007  * This class is derived from the abstract 
00008  * <A HREF="de.fub.bytecode.classfile.Constant.html">Constant</A> class 
00009  * and represents a reference to a long object.
00010  *
00011  * @version $Id: ConstantLong.java,v 1.1.1.1 2002/01/24 03:44:00 pserver Exp $
00012  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00013  * @see     Constant
00014  */
00015 public final class ConstantLong extends Constant {
00016   private long bytes;
00017 
00018   /** 
00019    * @param bytes Data
00020    */
00021   public ConstantLong(long bytes)
00022   {
00023     super(CONSTANT_Long);
00024     this.bytes = bytes;
00025   }  
00026   /**
00027    * Initialize from another object.
00028    */
00029   public ConstantLong(ConstantLong c) {
00030     this(c.getBytes());
00031   }  
00032   /** 
00033    * Initialize instance from file data.
00034    *
00035    * @param file Input stream
00036    * @throw IOException
00037    */
00038   ConstantLong(DataInputStream file) throws IOException
00039   {    
00040     this(file.readLong());
00041   }  
00042   /**
00043    * Called by objects that are traversing the nodes of the tree implicitely
00044    * defined by the contents of a Java class. I.e., the hierarchy of methods,
00045    * fields, attributes, etc. spawns a tree of objects.
00046    *
00047    * @param v Visitor object
00048    */
00049   public void accept(Visitor v) {
00050     v.visitConstantLong(this);
00051   }  
00052   /**
00053    * Dump constant long to file stream in binary format.
00054    *
00055    * @param file Output file stream
00056    * @throw IOException
00057    */ 
00058   public final void dump(DataOutputStream file) throws IOException
00059   {
00060     file.writeByte(tag);
00061     file.writeLong(bytes);
00062   }  
00063   /**
00064    * @return data, i.e. 8 bytes.
00065    */  
00066   public final long getBytes() { return bytes; }  
00067   /**
00068    * @param bytes.
00069    */
00070   public final void setBytes(long bytes) {
00071     this.bytes = bytes;
00072   }  
00073   /**
00074    * @return String representation.
00075    */
00076   public final String toString() {
00077     return super.toString() + "(bytes = " + bytes + ")";
00078   }  
00079 }

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