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


Java ClsUtil.CONSTANT_Utf8方法代码示例

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


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

示例1: readAnnotationClassName

import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
private String readAnnotationClassName(BytePointer ptr) throws ClsFormatException {
  // TODO: need this method because because of incomplete class format spec at the moment of writing
  // it is not clear what structure is expected: CONSTANT_Utf8 or CONSTANT_Class
  final int tag = ClsUtil.readU1(ptr);
  if (tag == ClsUtil.CONSTANT_Utf8) {
    return ClsUtil.getTypeText(ptr.bytes, ptr.offset + 2); //skip length
  }
  if (tag == ClsUtil.CONSTANT_Class){
    ptr.offset -= 1; // rollback
    return readClassInfo(ptr);
  }
  //noinspection HardCodedStringLiteral
  throw new ClsFormatException(CompilerBundle.message("class.parsing.error.wrong.record.tag.expected.another", tag, "CONSTANT_Utf8(" + ClsUtil.CONSTANT_Utf8 + ") / CONSTANT_Class(" + ClsUtil.CONSTANT_Class + ")"));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源: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_Utf8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。