當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。