本文整理汇总了Java中com.sun.java.util.jar.pack.ConstantPool.Utf8Entry类的典型用法代码示例。如果您正苦于以下问题:Java Utf8Entry类的具体用法?Java Utf8Entry怎么用?Java Utf8Entry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Utf8Entry类属于com.sun.java.util.jar.pack.ConstantPool包,在下文中一共展示了Utf8Entry类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readLocalInnerClasses
import com.sun.java.util.jar.pack.ConstantPool.Utf8Entry; //导入依赖的package包/类
void readLocalInnerClasses(Class cls) throws IOException {
int nc = class_InnerClasses_N.getInt();
List<InnerClass> localICs = new ArrayList<>(nc);
for (int i = 0; i < nc; i++) {
ClassEntry thisClass = (ClassEntry) class_InnerClasses_RC.getRef();
int flags = class_InnerClasses_F.getInt();
if (flags == 0) {
// A zero flag means copy a global IC here.
InnerClass ic = pkg.getGlobalInnerClass(thisClass);
assert(ic != null); // must be a valid global IC reference
localICs.add(ic);
} else {
if (flags == ACC_IC_LONG_FORM)
flags = 0; // clear the marker bit
ClassEntry outer = (ClassEntry) class_InnerClasses_outer_RCN.getRef();
Utf8Entry name = (Utf8Entry) class_InnerClasses_name_RUN.getRef();
localICs.add(new InnerClass(thisClass, outer, name, flags));
}
}
cls.setInnerClasses(localICs);
// cls.expandLocalICs may add more tuples to ics also,
// or may even delete tuples.
// We cannot do that now, because we do not know the
// full contents of the local constant pool yet.
}
示例2: transformSourceFile
import com.sun.java.util.jar.pack.ConstantPool.Utf8Entry; //导入依赖的package包/类
private void transformSourceFile(boolean minimize) {
// Replace "obvious" SourceFile by null.
Attribute olda = getAttribute(attrSourceFileSpecial);
if (olda == null)
return; // no SourceFile attr.
String obvious = getObviousSourceFile();
List<Entry> ref = new ArrayList<>(1);
olda.visitRefs(this, VRM_PACKAGE, ref);
Utf8Entry sfName = (Utf8Entry) ref.get(0);
Attribute a = olda;
if (sfName == null) {
if (minimize) {
// A pair of zero bytes. Cannot use predef. layout.
a = Attribute.find(ATTR_CONTEXT_CLASS, "SourceFile", "H");
a = a.addContent(new byte[2]);
} else {
// Expand null attribute to the obvious string.
byte[] bytes = new byte[2];
sfName = getRefString(obvious);
Object f = null;
f = Fixups.addRefWithBytes(f, bytes, sfName);
a = attrSourceFileSpecial.addContent(bytes, f);
}
} else if (obvious.equals(sfName.stringValue())) {
if (minimize) {
// Replace by an all-zero attribute.
a = attrSourceFileSpecial.addContent(new byte[2]);
} else {
assert(false);
}
}
if (a != olda) {
if (verbose > 2)
Utils.log.fine("recoding obvious SourceFile="+obvious);
List<Attribute> newAttrs = new ArrayList<>(getAttributes());
int where = newAttrs.indexOf(olda);
newAttrs.set(where, a);
setAttributes(newAttrs);
}
}
示例3: InnerClass
import com.sun.java.util.jar.pack.ConstantPool.Utf8Entry; //导入依赖的package包/类
InnerClass(ClassEntry thisClass, ClassEntry outerClass,
Utf8Entry name, int flags) {
this.thisClass = thisClass;
this.outerClass = outerClass;
this.name = name;
this.flags = flags;
this.predictable = computePredictable();
}
示例4: readMember
import com.sun.java.util.jar.pack.ConstantPool.Utf8Entry; //导入依赖的package包/类
void readMember(boolean doMethod) throws IOException {
int mflags = readUnsignedShort();
Utf8Entry mname = readUtf8Ref();
SignatureEntry mtype = readSignatureRef();
DescriptorEntry descr = ConstantPool.getDescriptorEntry(mname, mtype);
Class.Member m;
if (!doMethod)
m = cls.new Field(mflags, descr);
else
m = cls.new Method(mflags, descr);
readAttributes(!doMethod ? ATTR_CONTEXT_FIELD : ATTR_CONTEXT_METHOD,
m);
}
示例5: readInnerClasses
import com.sun.java.util.jar.pack.ConstantPool.Utf8Entry; //导入依赖的package包/类
void readInnerClasses(Class cls) throws IOException {
int nc = readUnsignedShort();
ArrayList<InnerClass> ics = new ArrayList<>(nc);
for (int i = 0; i < nc; i++) {
InnerClass ic =
new InnerClass(readClassRef(),
readClassRefOrNull(),
(Utf8Entry)readRefOrNull(CONSTANT_Utf8),
readUnsignedShort());
ics.add(ic);
}
cls.innerClasses = ics; // set directly; do not use setInnerClasses.
// (Later, ics may be transferred to the pkg.)
}
示例6: transformSourceFile
import com.sun.java.util.jar.pack.ConstantPool.Utf8Entry; //导入依赖的package包/类
private void transformSourceFile(boolean minimize) {
// Replace "obvious" SourceFile by null.
Attribute olda = getAttribute(attrSourceFileSpecial);
if (olda == null)
return; // no SourceFile attr.
String obvious = getObviousSourceFile();
List<Entry> ref = new ArrayList<>(1);
olda.visitRefs(this, VRM_PACKAGE, ref);
Utf8Entry sfName = (Utf8Entry) ref.get(0);
Attribute a = olda;
if (sfName == null) {
if (minimize) {
// A pair of zero bytes. Cannot use predef. layout.
a = Attribute.find(ATTR_CONTEXT_CLASS, "SourceFile", "H");
a = a.addContent(new byte[2]);
} else {
// Expand null attribute to the obvious string.
byte[] bytes = new byte[2];
sfName = getRefString(obvious);
Object f = null;
f = Fixups.add(f, bytes, 0, Fixups.U2_FORMAT, sfName);
a = attrSourceFileSpecial.addContent(bytes, f);
}
} else if (obvious.equals(sfName.stringValue())) {
if (minimize) {
// Replace by an all-zero attribute.
a = attrSourceFileSpecial.addContent(new byte[2]);
} else {
assert(false);
}
}
if (a != olda) {
if (verbose > 2)
Utils.log.fine("recoding obvious SourceFile="+obvious);
List<Attribute> newAttrs = new ArrayList<>(getAttributes());
int where = newAttrs.indexOf(olda);
newAttrs.set(where, a);
setAttributes(newAttrs);
}
}