當前位置: 首頁>>代碼示例>>Java>>正文


Java ClsUtil.CONSTANT_NameAndType方法代碼示例

本文整理匯總了Java中com.intellij.util.cls.ClsUtil.CONSTANT_NameAndType方法的典型用法代碼示例。如果您正苦於以下問題:Java ClsUtil.CONSTANT_NameAndType方法的具體用法?Java ClsUtil.CONSTANT_NameAndType怎麽用?Java ClsUtil.CONSTANT_NameAndType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.cls.ClsUtil的用法示例。


在下文中一共展示了ClsUtil.CONSTANT_NameAndType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:37,代碼來源:ClassFileReader.java

示例2: next

import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
/**
 * Positions the pointer to the next entry
 */
public void next() throws ClsFormatException {
  myPtr.offset = myCurrentOffset;
  int tag = ClsUtil.readU1(myPtr);
  switch(tag){
    default:
      throw new ClsFormatException();

    case ClsUtil.CONSTANT_Class:
    case ClsUtil.CONSTANT_String:
      myPtr.offset += 2;
    break;

    case ClsUtil.CONSTANT_Fieldref:
    case ClsUtil.CONSTANT_Methodref:
    case ClsUtil.CONSTANT_InterfaceMethodref:
    case ClsUtil.CONSTANT_Integer:
    case ClsUtil.CONSTANT_Float:
    case ClsUtil.CONSTANT_NameAndType:
      myPtr.offset += 4;
    break;

    case ClsUtil.CONSTANT_Long:
    case ClsUtil.CONSTANT_Double:
      myPtr.offset += 8;
      myCurrentEntryIndex++; // takes 2 entries
    break;

    case ClsUtil.CONSTANT_Utf8:
      int length = ClsUtil.readU2(myPtr);
      myPtr.offset += length;
    break;

    case ClsUtil.CONSTANT_MethodHandle:
      myPtr.offset += 3;
      break;
    case ClsUtil.CONSTANT_MethodType:
      myPtr.offset += 2;
      break;
    case ClsUtil.CONSTANT_InvokeDynamic:
      myPtr.offset += 4;
      break;
  }
  myCurrentEntryIndex++;
  myCurrentOffset = myPtr.offset;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:49,代碼來源:ClassFileReader.java

示例3: next

import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
/**
 * Positions the pointer to the next entry
 */
public void next() throws ClsFormatException {
  myPtr.offset = myCurrentOffset;
  int tag = ClsUtil.readU1(myPtr);
  switch(tag){
    default:
      throw new ClsFormatException();

    case ClsUtil.CONSTANT_Class:
    case ClsUtil.CONSTANT_String:
      myPtr.offset += 2;
      break;

    case ClsUtil.CONSTANT_Fieldref:
    case ClsUtil.CONSTANT_Methodref:
    case ClsUtil.CONSTANT_InterfaceMethodref:
    case ClsUtil.CONSTANT_Integer:
    case ClsUtil.CONSTANT_Float:
    case ClsUtil.CONSTANT_NameAndType:
      myPtr.offset += 4;
      break;

    case ClsUtil.CONSTANT_Long:
    case ClsUtil.CONSTANT_Double:
      myPtr.offset += 8;
      myCurrentEntryIndex++; // takes 2 entries
      break;

    case ClsUtil.CONSTANT_Utf8:
      int length = ClsUtil.readU2(myPtr);
      myPtr.offset += length;
      break;

    case ClsUtil.CONSTANT_MethodHandle:
      myPtr.offset += 3;
      break;
    case ClsUtil.CONSTANT_MethodType:
      myPtr.offset += 2;
      break;
    case ClsUtil.CONSTANT_InvokeDynamic:
      myPtr.offset += 4;
      break;
  }
  myCurrentEntryIndex++;
  myCurrentOffset = myPtr.offset;
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:49,代碼來源:ClassFileReader.java


注:本文中的com.intellij.util.cls.ClsUtil.CONSTANT_NameAndType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。