FileDocCategorySizeDatePackage
ConstantInteger.javaAPI DocJava SE 6 API4811Tue Jun 10 00:22:16 BST 2008com.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.2.1 2005/07/31 23:46:36 jeffsuttor 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
throws
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
throws
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 + ")";