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


Java AnnotatedBytes.getCursor方法代码示例

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


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

示例1: makeAnnotator

import org.jf.dexlib2.util.AnnotatedBytes; //导入方法依赖的package包/类
@Nonnull
public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) {
    return new SectionAnnotator(annotator, mapItem) {
        @Nonnull @Override public String getItemName() {
            return "header_item";
        }

        @Override
        protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) {
            int startOffset = out.getCursor();
            int headerSize;

            StringBuilder magicBuilder = new StringBuilder();
            for (int i=0; i<8; i++) {
                magicBuilder.append((char)dexFile.readUbyte(startOffset + i));
            }

            out.annotate(8, "magic: %s", StringUtils.escapeString(magicBuilder.toString()));
            out.annotate(4, "checksum");
            out.annotate(20, "signature");
            out.annotate(4, "file_size: %d", dexFile.readInt(out.getCursor()));

            headerSize = dexFile.readInt(out.getCursor());
            out.annotate(4, "header_size: %d", headerSize);

            int endianTag = dexFile.readInt(out.getCursor());
            out.annotate(4, "endian_tag: 0x%x (%s)", endianTag, getEndianText(endianTag));

            out.annotate(4, "link_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "link_offset: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "map_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "string_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "string_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "type_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "type_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "proto_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "proto_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "field_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "field_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "method_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "method_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "class_defs_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "class_defs_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "data_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "data_off: 0x%x", dexFile.readInt(out.getCursor()));

            if (headerSize > ITEM_SIZE) {
                out.annotateTo(headerSize, "header padding");
            }
        }
    };
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:61,代码来源:HeaderItem.java

示例2: makeAnnotator

import org.jf.dexlib2.util.AnnotatedBytes; //导入方法依赖的package包/类
public static SectionAnnotator makeAnnotator( DexAnnotator annotator,  MapItem mapItem) {
    return new SectionAnnotator(annotator, mapItem) {
         @Override public String getItemName() {
            return "header_item";
        }

        @Override
        protected void annotateItem( AnnotatedBytes out, int itemIndex,  String itemIdentity) {
            int startOffset = out.getCursor();
            int headerSize;

            StringBuilder magicBuilder = new StringBuilder();
            for (int i=0; i<8; i++) {
                magicBuilder.append((char)dexFile.readUbyte(startOffset + i));
            }

            out.annotate(8, "magic: %s", StringUtils.escapeString(magicBuilder.toString()));
            out.annotate(4, "checksum");
            out.annotate(20, "signature");
            out.annotate(4, "file_size: %d", dexFile.readInt(out.getCursor()));

            headerSize = dexFile.readInt(out.getCursor());
            out.annotate(4, "header_size: %d", headerSize);

            int endianTag = dexFile.readInt(out.getCursor());
            out.annotate(4, "endian_tag: 0x%x (%s)", endianTag, getEndianText(endianTag));

            out.annotate(4, "link_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "link_offset: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "map_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "string_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "string_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "type_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "type_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "proto_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "proto_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "field_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "field_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "method_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "method_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "class_defs_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "class_defs_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "data_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "data_off: 0x%x", dexFile.readInt(out.getCursor()));

            if (headerSize > ITEM_SIZE) {
                out.annotateTo(headerSize, "header padding");
            }
        }
    };
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:60,代码来源:HeaderItem.java

示例3: makeAnnotator

import org.jf.dexlib2.util.AnnotatedBytes; //导入方法依赖的package包/类
@Nonnull
public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) {
    return new SectionAnnotator(annotator, mapItem) {
        @Nonnull
        @Override
        public String getItemName() {
            return "header_item";
        }

        @Override
        protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) {
            int startOffset = out.getCursor();
            int headerSize;

            StringBuilder magicBuilder = new StringBuilder();
            for (int i = 0; i < 8; i++) {
                magicBuilder.append((char) dexFile.readUbyte(startOffset + i));
            }

            out.annotate(8, "magic: %s", StringUtils.escapeString(magicBuilder.toString()));
            out.annotate(4, "checksum");
            out.annotate(20, "signature");
            out.annotate(4, "file_size: %d", dexFile.readInt(out.getCursor()));

            headerSize = dexFile.readInt(out.getCursor());
            out.annotate(4, "header_size: %d", headerSize);

            int endianTag = dexFile.readInt(out.getCursor());
            out.annotate(4, "endian_tag: 0x%x (%s)", endianTag, getEndianText(endianTag));

            out.annotate(4, "link_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "link_offset: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "map_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "string_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "string_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "type_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "type_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "proto_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "proto_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "field_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "field_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "method_ids_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "method_ids_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "class_defs_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "class_defs_off: 0x%x", dexFile.readInt(out.getCursor()));

            out.annotate(4, "data_size: %d", dexFile.readInt(out.getCursor()));
            out.annotate(4, "data_off: 0x%x", dexFile.readInt(out.getCursor()));

            if (headerSize > ITEM_SIZE) {
                out.annotateTo(headerSize, "header padding");
            }
        }
    };
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:63,代码来源:HeaderItem.java


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