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


Java ClsUtil.readU4方法代码示例

本文整理汇总了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();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:ClassFileReader.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ClassFileReader.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:ClassFileReader.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:ClassFileReader.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:ClassFileReader.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:16,代码来源:ClassFileReader.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:ClassFileReader.java


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