FileDocCategorySizeDatePackage
ConstantUtf8.javaAPI DocJava SE 6 API4827Tue Jun 10 00:22:16 BST 2008com.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.2.1 2005/07/31 23:46:26 jeffsuttor 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
throws
IOException

    
    super(Constants.CONSTANT_Utf8);

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

param
bytes Data

    super(Constants.CONSTANT_Utf8);

    if(bytes == null)
      throw new IllegalArgumentException("bytes must not be null!");

    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
throws
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") + "\")";