当前位置: 首页>>代码示例>>Java>>正文


Java ClassFileReader.u2At方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.u2At方法的典型用法代码示例。如果您正苦于以下问题:Java ClassFileReader.u2At方法的具体用法?Java ClassFileReader.u2At怎么用?Java ClassFileReader.u2At使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader的用法示例。


在下文中一共展示了ClassFileReader.u2At方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildImports

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; //导入方法依赖的package包/类
public ImportReference[] buildImports(ClassFileReader reader) {
	// add remaining references to the list of type names
	// (code extracted from BinaryIndexer#extractReferenceFromConstantPool(...))
	int[] constantPoolOffsets = reader.getConstantPoolOffsets();
	int constantPoolCount = constantPoolOffsets.length;
	for (int i = 0; i < constantPoolCount; i++) {
		int tag = reader.u1At(constantPoolOffsets[i]);
		char[] name = null;
		switch (tag) {
			case ClassFileConstants.MethodRefTag :
			case ClassFileConstants.InterfaceMethodRefTag :
				int constantPoolIndex = reader.u2At(constantPoolOffsets[i] + 3);
				int utf8Offset = constantPoolOffsets[reader.u2At(constantPoolOffsets[constantPoolIndex] + 3)];
				name = reader.utf8At(utf8Offset + 3, reader.u2At(utf8Offset + 1));
				break;
			case ClassFileConstants.ClassTag :
				utf8Offset = constantPoolOffsets[reader.u2At(constantPoolOffsets[i] + 1)];
				name = reader.utf8At(utf8Offset + 3, reader.u2At(utf8Offset + 1));
				break;
		}
		if (name == null || (name.length > 0 && name[0] == '['))
			break; // skip over array references
		this.typeNames.add(CharOperation.splitOn('/', name));
	}

	// convert type names into import references
	int typeNamesLength = this.typeNames.size();
	ImportReference[] imports = new ImportReference[typeNamesLength];
	char[][][] set = this.typeNames.set;
	int index = 0;
	for (int i = 0, length = set.length; i < length; i++) {
		char[][] typeName = set[i];
		if (typeName != null) {
			imports[index++] = new ImportReference(typeName, new long[typeName.length]/*dummy positions*/, false/*not on demand*/, 0);
		}
	}
	return imports;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:BinaryTypeConverter.java

示例2: extractClassName

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; //导入方法依赖的package包/类
private char[] extractClassName(int[] constantPoolOffsets, ClassFileReader reader, int index) {
	// the entry at i has to be a field ref or a method/interface method ref.
	int class_index = reader.u2At(constantPoolOffsets[index] + 1);
	int utf8Offset = constantPoolOffsets[reader.u2At(constantPoolOffsets[class_index] + 1)];
	return reader.utf8At(utf8Offset + 3, reader.u2At(utf8Offset + 1));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:BinaryIndexer.java

示例3: extractName

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; //导入方法依赖的package包/类
private char[] extractName(int[] constantPoolOffsets, ClassFileReader reader, int index) {
	int nameAndTypeIndex = reader.u2At(constantPoolOffsets[index] + 3);
	int utf8Offset = constantPoolOffsets[reader.u2At(constantPoolOffsets[nameAndTypeIndex] + 1)];
	return reader.utf8At(utf8Offset + 3, reader.u2At(utf8Offset + 1));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:6,代码来源:BinaryIndexer.java

示例4: extractClassReference

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; //导入方法依赖的package包/类
private char[] extractClassReference(int[] constantPoolOffsets, ClassFileReader reader, int index) {
	// the entry at i has to be a class ref.
	int utf8Offset = constantPoolOffsets[reader.u2At(constantPoolOffsets[index] + 1)];
	return reader.utf8At(utf8Offset + 3, reader.u2At(utf8Offset + 1));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:6,代码来源:BinaryIndexer.java

示例5: extractType

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; //导入方法依赖的package包/类
private char[] extractType(int[] constantPoolOffsets, ClassFileReader reader, int index) {
	int constantPoolIndex = reader.u2At(constantPoolOffsets[index] + 3);
	int utf8Offset = constantPoolOffsets[reader.u2At(constantPoolOffsets[constantPoolIndex] + 3)];
	return reader.utf8At(utf8Offset + 3, reader.u2At(utf8Offset + 1));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:6,代码来源:BinaryIndexer.java


注:本文中的org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.u2At方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。