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

ConstantUtf8

public final class ConstantUtf8 extends Constant
This class is derived from the abstract Constant class and represents a reference to a Utf8 encoded string.
version
$Id: ConstantUtf8.java,v 1.1.1.1 2001/10/29 20:00:00 jvanzyl Exp $
author
M. Dahm
see
Constant

Fields Summary
private String
bytes
Constructors Summary
public ConstantUtf8(ConstantUtf8 c)
Initialize from another object.

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

param
file Input stream
throw
IOException

    
    super(Constants.CONSTANT_Utf8);

    bytes = file.readUTF();
  
public ConstantUtf8(String bytes)

param
bytes Data

    super(Constants.CONSTANT_Utf8);
    this.bytes  = bytes;
  
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.visitConstantUtf8(this);
  
public final voiddump(java.io.DataOutputStream file)
Dump String in Utf8 format to file stream.

param
file Output file stream
throw
IOException

    file.writeByte(tag);
    file.writeUTF(bytes);
  
public final java.lang.StringgetBytes()

return
Data converted to string.

 return bytes; 
public final voidsetBytes(java.lang.String bytes)

param
bytes.

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

return
String representation

    return super.toString() + "(\"" + Utility.replace(bytes, "\n", "\\n") + "\")";