FileDocCategorySizeDatePackage
ConstantInteger.javaAPI DocJava SE 5 API4806Fri Aug 26 14:55:16 BST 2005com.sun.org.apache.bcel.internal.classfile

ConstantInteger

public final class ConstantInteger extends Constant implements ConstantObject
This class is derived from the abstract Constant class and represents a reference to an int object.
version
$Id: ConstantInteger.java,v 1.1.1.1 2001/10/29 19:59:59 jvanzyl Exp $
author
M. Dahm
see
Constant

Fields Summary
private int
bytes
Constructors Summary
public ConstantInteger(int bytes)

param
bytes Data

    
    super(Constants.CONSTANT_Integer);
    this.bytes = bytes;
  
public ConstantInteger(ConstantInteger c)
Initialize from another object.

    this(c.getBytes());
  
ConstantInteger(DataInputStream file)
Initialize instance from file data.

param
file Input stream
throw
IOException

    
    this(file.readInt());
  
Methods Summary
public voidaccept(com.sun.org.apache.bcel.internal.classfile.Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

param
v Visitor object

    v.visitConstantInteger(this);
  
public final voiddump(java.io.DataOutputStream file)
Dump constant integer to file stream in binary format.

param
file Output file stream
throw
IOException

    file.writeByte(tag);
    file.writeInt(bytes);
  
public final intgetBytes()

return
data, i.e., 4 bytes.

 return bytes; 
public java.lang.ObjectgetConstantValue(com.sun.org.apache.bcel.internal.classfile.ConstantPool cp)

return
Integer object

    return new Integer(bytes);
  
public final voidsetBytes(int bytes)

param
bytes.

    this.bytes = bytes;
  
public final java.lang.StringtoString()

return
String representation.

    return super.toString() + "(bytes = " + bytes + ")";