1 package com.sun.org.apache.bcel.internal.classfile; 2 3 56 57 import com.sun.org.apache.bcel.internal.Constants; 58 import java.io.*; 59 60 69 public final class ConstantUtf8 extends Constant { 70 private String bytes; 71 72 75 public ConstantUtf8(ConstantUtf8 c) { 76 this(c.getBytes()); 77 } 78 79 85 ConstantUtf8(DataInputStream file) throws IOException 86 { 87 super(Constants.CONSTANT_Utf8); 88 89 bytes = file.readUTF(); 90 } 91 92 95 public ConstantUtf8(String bytes) 96 { 97 super(Constants.CONSTANT_Utf8); 98 this.bytes = bytes; 99 } 100 101 108 public void accept(Visitor v) { 109 v.visitConstantUtf8(this); 110 } 111 112 118 public final void dump(DataOutputStream file) throws IOException 119 { 120 file.writeByte(tag); 121 file.writeUTF(bytes); 122 } 123 124 127 public final String getBytes() { return bytes; } 128 129 132 public final void setBytes(String bytes) { 133 this.bytes = bytes; 134 } 135 136 139 public final String toString() 140 { 141 return super.toString() + "(\"" + Utility.replace(bytes, "\n", "\\n") + "\")"; 142 } 143 } 144 | Popular Tags |