本文整理汇总了Java中com.intellij.util.cls.ClsUtil.readU4方法的典型用法代码示例。如果您正苦于以下问题:Java ClsUtil.readU4方法的具体用法?Java ClsUtil.readU4怎么用?Java ClsUtil.readU4使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.cls.ClsUtil
的用法示例。
在下文中一共展示了ClsUtil.readU4方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ConstantPoolIterator
import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
public ConstantPoolIterator(BytePointer ptr) throws ClsFormatException {
myPtr = ptr;
myPtr.offset = 0;
int magic = ClsUtil.readU4(myPtr);
if (magic != ClsUtil.MAGIC){
throw new ClsFormatException();
}
myPtr.offset += 2; // minor version
myPtr.offset += 2; // major version
myEntryCount = ClsUtil.readU2(myPtr);
if (myEntryCount < 1){
throw new ClsFormatException();
}
myCurrentEntryIndex = 1; // Entry at index 0 is included in the count but is not present in the constant pool
myCurrentOffset = myPtr.offset;
}
示例3: 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);
}
示例4: 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;
}
示例5: readFieldConstantValue
import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
private ConstantValue readFieldConstantValue(BytePointer p) throws ClsFormatException{
final BytePointer ptr = new BytePointer(p.bytes, p.offset + 2);
if (ClsUtil.readU4(ptr) != 2) {
throw new ClsFormatException(); // attribute length must be 2
}
int valueIndex = ClsUtil.readU2(ptr);
ptr.offset = getOffsetInConstantPool(valueIndex);
return readConstant(ptr);
}
示例6: 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);
}
示例7: gotoNextAttribute
import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
private static void gotoNextAttribute(BytePointer ptr) throws ClsFormatException {
ptr.offset += 2; // skip name index
final int length = ClsUtil.readU4(ptr); // important! Do not inline since ptr.offset is also changed inside ClsUtil.readU4() method
ptr.offset += length;
}