Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 17 package org.apache.bcel.classfile; 18 19 import java.io.DataInputStream ; 20 import java.io.DataOutputStream ; 21 import java.io.IOException ; 22 import org.apache.bcel.Constants; 23 24 33 public final class ConstantUtf8 extends Constant { 34 35 private String bytes; 36 37 38 41 public ConstantUtf8(ConstantUtf8 c) { 42 this(c.getBytes()); 43 } 44 45 46 52 ConstantUtf8(DataInputStream file) throws IOException { 53 super(Constants.CONSTANT_Utf8); 54 bytes = file.readUTF(); 55 } 56 57 58 61 public ConstantUtf8(String bytes) { 62 super(Constants.CONSTANT_Utf8); 63 if (bytes == null) { 64 throw new IllegalArgumentException ("bytes must not be null!"); 65 } 66 this.bytes = bytes; 67 } 68 69 70 77 public void accept( Visitor v ) { 78 v.visitConstantUtf8(this); 79 } 80 81 82 88 public final void dump( DataOutputStream file ) throws IOException { 89 file.writeByte(tag); 90 file.writeUTF(bytes); 91 } 92 93 94 97 public final String getBytes() { 98 return bytes; 99 } 100 101 102 105 public final void setBytes( String bytes ) { 106 this.bytes = bytes; 107 } 108 109 110 113 public final String toString() { 114 return super.toString() + "(\"" + Utility.replace(bytes, "\n", "\\n") + "\")"; 115 } 116 } 117
| Popular Tags
|