本文整理汇总了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");
}
}
};
}
示例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");
}
}
};
}
示例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");
}
}
};
}