本文整理匯總了Java中com.intellij.util.cls.ClsUtil.readUtf8Info方法的典型用法代碼示例。如果您正苦於以下問題:Java ClsUtil.readUtf8Info方法的具體用法?Java ClsUtil.readUtf8Info怎麽用?Java ClsUtil.readUtf8Info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.util.cls.ClsUtil
的用法示例。
在下文中一共展示了ClsUtil.readUtf8Info方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readConstant
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
private ConstantValue readConstant(final BytePointer ptr) throws ClsFormatException {
final int tag = ClsUtil.readU1(ptr);
switch (tag) {
case ClsUtil.CONSTANT_Integer :
int value = ClsUtil.readU4(ptr);
return new IntegerConstantValue(value);
case ClsUtil.CONSTANT_Float:
float floatValue = ClsUtil.readFloat(ptr);
return new FloatConstantValue(floatValue);
case ClsUtil.CONSTANT_Long :
int high = ClsUtil.readU4(ptr);
int low = ClsUtil.readU4(ptr);
long v = ((long)high << 32) | (low & 0xFFFFFFFFL);
return new LongConstantValue(v);
case ClsUtil.CONSTANT_Double :
double doubleValue = ClsUtil.readDouble(ptr);
return new DoubleConstantValue(doubleValue);
case ClsUtil.CONSTANT_String :
int stringIndex = ClsUtil.readU2(ptr);
ptr.offset = getOffsetInConstantPool(stringIndex);
return new StringConstantValue(ClsUtil.readUtf8Info(ptr));
default : throw new ClsFormatException();
}
}
示例2: getQualifiedName
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
public String getQualifiedName() throws ClsFormatException {
if (myQualifiedName == null) {
BytePointer ptr = new BytePointer(getData(), getConstantPoolEnd() + 2);
ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
int tag = ClsUtil.readU1(ptr);
if (tag != ClsUtil.CONSTANT_Class){
throw new ClsFormatException();
}
ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
myQualifiedName = ClsUtil.readUtf8Info(ptr, '/', '.'); // keep '$' in the names
}
return myQualifiedName;
}
示例3: readRefStructure
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
private MemberReferenceInfo readRefStructure(int tag, BytePointer ptr) throws ClsFormatException {
/*
if (tag != ClsUtil.CONSTANT_Fieldref && tag != ClsUtil.CONSTANT_Methodref && tag != ClsUtil.CONSTANT_InterfaceMethodref) {
throw new ClsFormatException();
}
*/
int classInfoIndex = ClsUtil.readU2(ptr);
int nameTypeInfoIndex = ClsUtil.readU2(ptr);
ptr.offset = getOffsetInConstantPool(classInfoIndex);
if (ClsUtil.CONSTANT_Class != ClsUtil.readU1(ptr)) {
throw new ClsFormatException();
}
ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
String className = ClsUtil.readUtf8Info(ptr, '/', '.'); // keep '$' in names
ptr.offset = getOffsetInConstantPool(nameTypeInfoIndex);
if (ClsUtil.CONSTANT_NameAndType != ClsUtil.readU1(ptr)) {
throw new ClsFormatException();
}
int memberNameIndex = ClsUtil.readU2(ptr);
int descriptorIndex = ClsUtil.readU2(ptr);
ptr.offset = getOffsetInConstantPool(memberNameIndex);
String memberName = ClsUtil.readUtf8Info(ptr);
if ((memberName.indexOf('$') >= 0 || memberName.indexOf('<') >= 0) && !CONSTRUCTOR_NAME.equals(memberName)) { // skip refs to synthetic members
return null;
}
ptr.offset = getOffsetInConstantPool(descriptorIndex);
String descriptor = ClsUtil.readUtf8Info(ptr);
MemberInfo info = ClsUtil.CONSTANT_Fieldref == tag? new FieldInfo(getSymbolId(memberName), getSymbolId(descriptor)) : new MethodInfo(getSymbolId(memberName), getSymbolId(descriptor), CONSTRUCTOR_NAME.equals(memberName));
return new MemberReferenceInfo(getSymbolId(className), info);
}
示例4: readClassInfo
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
private String readClassInfo(BytePointer ptr) throws ClsFormatException{
final int tag = ClsUtil.readU1(ptr);
if (tag != ClsUtil.CONSTANT_Class){
throw new ClsFormatException(CompilerBundle.message("class.parsing.error.wrong.record.tag.expected.another", tag, ClsUtil.CONSTANT_Class));
}
int index = ClsUtil.readU2(ptr);
return ClsUtil.readUtf8Info(new BytePointer(ptr.bytes, getOffsetInConstantPool(index)), '/', '.');
}
示例5: readSignatureAttribute
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
/**
Signature_attribute {
u2 attribute_name_index; (must be equal to "Signature")
u4 attribute_length; (must be equal to 2)
u2 signature_index;
}
*/
private String readSignatureAttribute(BytePointer p) throws ClsFormatException {
final BytePointer ptr = new BytePointer(p.bytes, p.offset + 2); // position to the length
if (ClsUtil.readU4(ptr) != 2) {
return null;
}
ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
return ClsUtil.readUtf8Info(ptr);
}
示例6: readSourceFileAttribute
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
private String readSourceFileAttribute(BytePointer p) throws ClsFormatException {
BytePointer ptr = new BytePointer(p.bytes, p.offset + 2); // position to the length
if (ClsUtil.readU4(ptr) != 2) {
return null;
}
ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
String path = ClsUtil.readUtf8Info(ptr);
// jdk version 1.3.0 puts full path to the source, but later versions store only short name
final int slashIndex = path.lastIndexOf('/');
if (slashIndex >= 0) {
path = path.substring(slashIndex + 1, path.length());
}
return path;
}
示例7: readAnnotation
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
private AnnotationConstantValue readAnnotation(BytePointer ptr) throws ClsFormatException {
final int classInfoIndex = ClsUtil.readU2(ptr);
final String qName = readAnnotationClassName(new BytePointer(ptr.bytes, getOffsetInConstantPool(classInfoIndex)));
final List<AnnotationNameValuePair> memberValues = new ArrayList<AnnotationNameValuePair>();
final int numberOfPairs = ClsUtil.readU2(ptr);
for (int idx = 0; idx < numberOfPairs; idx++) {
final int memberNameIndex = ClsUtil.readU2(ptr);
final String memberName = ClsUtil.readUtf8Info(ptr.bytes, getOffsetInConstantPool(memberNameIndex));
final ConstantValue memberValue = readAnnotationMemberValue(ptr);
memberValues.add(new AnnotationNameValuePair(getSymbolId(memberName), memberValue));
}
return new AnnotationConstantValue(getSymbolId(qName), memberValues.toArray(new AnnotationNameValuePair[memberValues.size()]));
}
示例8: readSignatureAttribute
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
/**
Signature_attribute {
u2 attribute_name_index; (must be equal to "Signature")
u4 attribute_length; (must be equal to 2)
u2 signature_index;
}
*/
private String readSignatureAttribute(BytePointer p) throws ClsFormatException {
final BytePointer ptr = new BytePointer(p.bytes, p.offset + 2); // position to the length
if (ClsUtil.readU4(ptr) != 2) {
return null;
}
ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
return ClsUtil.readUtf8Info(ptr);
}
示例9: readAttributeName
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
private String readAttributeName(BytePointer p) throws ClsFormatException {
final BytePointer ptr = new BytePointer(p.bytes, p.offset);
final int nameIndex = ClsUtil.readU2(ptr);
ptr.offset = getOffsetInConstantPool(nameIndex);
return ClsUtil.readUtf8Info(ptr);
}