本文整理汇总了Java中org.jf.dexlib2.dexbacked.raw.CodeItem类的典型用法代码示例。如果您正苦于以下问题:Java CodeItem类的具体用法?Java CodeItem怎么用?Java CodeItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CodeItem类属于org.jf.dexlib2.dexbacked.raw包,在下文中一共展示了CodeItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstructions
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Nonnull @Override public Iterable<? extends Instruction> getInstructions() {
// instructionsSize is the number of 16-bit code units in the instruction list, not the number of instructions
int instructionsSize = dexFile.readSmallUint(codeOffset + CodeItem.INSTRUCTION_COUNT_OFFSET);
final int instructionsStartOffset = codeOffset + CodeItem.INSTRUCTION_START_OFFSET;
final int endOffset = instructionsStartOffset + (instructionsSize*2);
return new Iterable<Instruction>() {
@Override
public Iterator<Instruction> iterator() {
return new VariableSizeLookaheadIterator<Instruction>(dexFile, instructionsStartOffset) {
@Override
protected Instruction readNextItem(@Nonnull DexReader reader) {
if (reader.getOffset() >= endOffset) {
return null;
}
return DexBackedInstruction.readFrom(reader);
}
};
}
};
}
示例2: getTryBlocks
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Override
public List<? extends DexBackedTryBlock> getTryBlocks() {
final int triesSize = dexFile.readUshort(codeOffset + CodeItem.TRIES_SIZE_OFFSET);
if (triesSize > 0) {
int instructionsSize = dexFile.readSmallUint(codeOffset + CodeItem.INSTRUCTION_COUNT_OFFSET);
final int triesStartOffset = AlignmentUtils.alignOffset(
codeOffset + CodeItem.INSTRUCTION_START_OFFSET + (instructionsSize*2), 4);
final int handlersStartOffset = triesStartOffset + triesSize*CodeItem.TryItem.ITEM_SIZE;
return new FixedSizeList<DexBackedTryBlock>() {
@Override
public DexBackedTryBlock readItem(int index) {
return new DexBackedTryBlock(dexFile,
triesStartOffset + index*CodeItem.TryItem.ITEM_SIZE,
handlersStartOffset);
}
@Override
public int size() {
return triesSize;
}
};
}
return ImmutableList.of();
}
示例3: getDebugInfo
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
private DebugInfo getDebugInfo() {
int debugOffset = dexFile.readInt(codeOffset + CodeItem.DEBUG_INFO_OFFSET);
if (debugOffset == -1 || debugOffset == 0) {
return DebugInfo.newOrEmpty(dexFile, 0, this);
}
if (debugOffset < 0) {
System.err.println(String.format("%s: Invalid debug offset", method));
return DebugInfo.newOrEmpty(dexFile, 0, this);
}
if (debugOffset >= dexFile.buf.length) {
System.err.println(String.format("%s: Invalid debug offset", method));
return DebugInfo.newOrEmpty(dexFile, 0, this);
}
return DebugInfo.newOrEmpty(dexFile, debugOffset, this);
}
示例4: getInstructions
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Nonnull
@Override
public Iterable<? extends Instruction> getInstructions() {
// instructionsSize is the number of 16-bit code units in the instruction list, not the number of instructions
int instructionsSize = dexFile.readSmallUint(codeOffset + CodeItem.INSTRUCTION_COUNT_OFFSET);
final int instructionsStartOffset = codeOffset + CodeItem.INSTRUCTION_START_OFFSET;
final int endOffset = instructionsStartOffset + (instructionsSize * 2);
return new Iterable<Instruction>() {
@Override
public Iterator<Instruction> iterator() {
return new VariableSizeLookaheadIterator<Instruction>(dexFile, instructionsStartOffset) {
@Override
protected Instruction readNextItem(@Nonnull DexReader reader) {
if (reader.getOffset() >= endOffset) {
return null;
}
return DexBackedInstruction.readFrom(reader);
}
};
}
};
}
示例5: getInstructions
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Nonnull @Override public Iterable<? extends Instruction> getInstructions() {
// instructionsSize is the number of 16-bit code units in the instruction list, not the number of instructions
int instructionsSize = dexFile.readSmallUint(codeOffset + CodeItem.INSTRUCTION_COUNT_OFFSET);
final int instructionsStartOffset = codeOffset + CodeItem.INSTRUCTION_START_OFFSET;
final int endOffset = instructionsStartOffset + (instructionsSize*2);
return new Iterable<Instruction>() {
@Override
public Iterator<Instruction> iterator() {
return new VariableSizeLookaheadIterator<Instruction>(dexFile, instructionsStartOffset) {
@Override
protected Instruction readNextItem(@Nonnull DexReader reader) {
if (reader.getOffset() >= endOffset) {
return endOfData();
}
Instruction instruction = DexBackedInstruction.readFrom(reader);
// Does the instruction extend past the end of the method?
int offset = reader.getOffset();
if (offset > endOffset || offset < 0) {
throw new ExceptionWithContext("The last instruction in the method is truncated");
}
return instruction;
}
};
}
};
}
示例6: getTryBlocks
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Nonnull
@Override
public List<? extends DexBackedTryBlock> getTryBlocks() {
final int triesSize = dexFile.readUshort(codeOffset + CodeItem.TRIES_SIZE_OFFSET);
if (triesSize > 0) {
int instructionsSize = dexFile.readSmallUint(codeOffset + CodeItem.INSTRUCTION_COUNT_OFFSET);
final int triesStartOffset = AlignmentUtils.alignOffset(
codeOffset + CodeItem.INSTRUCTION_START_OFFSET + (instructionsSize*2), 4);
final int handlersStartOffset = triesStartOffset + triesSize*CodeItem.TryItem.ITEM_SIZE;
return new FixedSizeList<DexBackedTryBlock>() {
@Nonnull
@Override
public DexBackedTryBlock readItem(int index) {
return new DexBackedTryBlock(dexFile,
triesStartOffset + index*CodeItem.TryItem.ITEM_SIZE,
handlersStartOffset);
}
@Override
public int size() {
return triesSize;
}
};
}
return ImmutableList.of();
}
示例7: getInstructions
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Override public Iterable<? extends Instruction> getInstructions() {
// instructionsSize is the number of 16-bit code units in the instruction list, not the number of instructions
int instructionsSize = dexFile.readSmallUint(codeOffset + CodeItem.INSTRUCTION_COUNT_OFFSET);
final int instructionsStartOffset = codeOffset + CodeItem.INSTRUCTION_START_OFFSET;
final int endOffset = instructionsStartOffset + (instructionsSize*2);
return new Iterable<Instruction>() {
@Override
public Iterator<Instruction> iterator() {
return new VariableSizeLookaheadIterator<Instruction>(dexFile, instructionsStartOffset) {
@Override
protected Instruction readNextItem( DexReader reader) {
if (reader.getOffset() >= endOffset) {
return endOfData();
}
Instruction instruction = DexBackedInstruction.readFrom(reader);
// Does the instruction extend past the end of the method?
int offset = reader.getOffset();
if (offset > endOffset || offset < 0) {
throw new ExceptionWithContext("The last instruction in method %s is truncated", method);
}
return instruction;
}
};
}
};
}
示例8: getDebugInfo
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Nonnull
private DebugInfo getDebugInfo() {
int debugOffset = dexFile.readInt(codeOffset + CodeItem.DEBUG_INFO_OFFSET);
if (debugOffset == -1 || debugOffset == 0) {
return DebugInfo.newOrEmpty(dexFile, 0, this);
}
if (debugOffset < 0) {
System.err.println("%s: Invalid debug offset");
return DebugInfo.newOrEmpty(dexFile, 0, this);
}
return DebugInfo.newOrEmpty(dexFile, debugOffset, this);
}
示例9: getTryBlocks
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Nonnull
@Override
public List<? extends DexBackedTryBlock> getTryBlocks() {
final int triesSize = dexFile.readUshort(codeOffset + CodeItem.TRIES_SIZE_OFFSET);
if (triesSize > 0) {
int instructionsSize = dexFile.readSmallUint(codeOffset + CodeItem.INSTRUCTION_COUNT_OFFSET);
final int triesStartOffset = AlignmentUtils.alignOffset(
codeOffset + CodeItem.INSTRUCTION_START_OFFSET + (instructionsSize * 2), 4);
final int handlersStartOffset = triesStartOffset + triesSize * CodeItem.TryItem.ITEM_SIZE;
return new FixedSizeList<DexBackedTryBlock>() {
@Nonnull
@Override
public DexBackedTryBlock readItem(int index) {
return new DexBackedTryBlock(dexFile,
triesStartOffset + index * CodeItem.TryItem.ITEM_SIZE,
handlersStartOffset);
}
@Override
public int size() {
return triesSize;
}
};
}
return ImmutableList.of();
}
示例10: getStartCodeAddress
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Override public int getStartCodeAddress() {
return dexFile.readSmallUint(tryItemOffset + CodeItem.TryItem.START_ADDRESS_OFFSET);
}
示例11: getCodeUnitCount
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Override public int getCodeUnitCount() {
return dexFile.readUshort(tryItemOffset + CodeItem.TryItem.CODE_UNIT_COUNT_OFFSET);
}
示例12: getDebugInfo
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Nonnull
private DebugInfo getDebugInfo() {
return DebugInfo.newOrEmpty(dexFile, dexFile.readSmallUint(codeOffset + CodeItem.DEBUG_INFO_OFFSET), this);
}
示例13: getStartCodeAddress
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Override
public int getStartCodeAddress() {
return dexFile.readSmallUint(tryItemOffset + CodeItem.TryItem.START_ADDRESS_OFFSET);
}
示例14: getCodeUnitCount
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
@Override
public int getCodeUnitCount() {
return dexFile.readUshort(tryItemOffset + CodeItem.TryItem.CODE_UNIT_COUNT_OFFSET);
}
示例15: DexAnnotator
import org.jf.dexlib2.dexbacked.raw.CodeItem; //导入依赖的package包/类
public DexAnnotator(@Nonnull RawDexFile dexFile, int width) {
super(width);
this.dexFile = dexFile;
for (MapItem mapItem : dexFile.getMapItems()) {
switch (mapItem.getType()) {
case ItemType.HEADER_ITEM:
annotators.put(mapItem.getType(), HeaderItem.makeAnnotator(this, mapItem));
break;
case ItemType.STRING_ID_ITEM:
annotators.put(mapItem.getType(), StringIdItem.makeAnnotator(this, mapItem));
break;
case ItemType.TYPE_ID_ITEM:
annotators.put(mapItem.getType(), TypeIdItem.makeAnnotator(this, mapItem));
break;
case ItemType.PROTO_ID_ITEM:
annotators.put(mapItem.getType(), ProtoIdItem.makeAnnotator(this, mapItem));
break;
case ItemType.FIELD_ID_ITEM:
annotators.put(mapItem.getType(), FieldIdItem.makeAnnotator(this, mapItem));
break;
case ItemType.METHOD_ID_ITEM:
annotators.put(mapItem.getType(), MethodIdItem.makeAnnotator(this, mapItem));
break;
case ItemType.CLASS_DEF_ITEM:
annotators.put(mapItem.getType(), ClassDefItem.makeAnnotator(this, mapItem));
break;
case ItemType.MAP_LIST:
annotators.put(mapItem.getType(), MapItem.makeAnnotator(this, mapItem));
break;
case ItemType.TYPE_LIST:
annotators.put(mapItem.getType(), TypeListItem.makeAnnotator(this, mapItem));
break;
case ItemType.ANNOTATION_SET_REF_LIST:
annotators.put(mapItem.getType(), AnnotationSetRefList.makeAnnotator(this, mapItem));
break;
case ItemType.ANNOTATION_SET_ITEM:
annotators.put(mapItem.getType(), AnnotationSetItem.makeAnnotator(this, mapItem));
break;
case ItemType.CLASS_DATA_ITEM:
annotators.put(mapItem.getType(), ClassDataItem.makeAnnotator(this, mapItem));
break;
case ItemType.CODE_ITEM:
annotators.put(mapItem.getType(), CodeItem.makeAnnotator(this, mapItem));
break;
case ItemType.STRING_DATA_ITEM:
annotators.put(mapItem.getType(), StringDataItem.makeAnnotator(this, mapItem));
break;
case ItemType.DEBUG_INFO_ITEM:
annotators.put(mapItem.getType(), DebugInfoItem.makeAnnotator(this, mapItem));
break;
case ItemType.ANNOTATION_ITEM:
annotators.put(mapItem.getType(), AnnotationItem.makeAnnotator(this, mapItem));
break;
case ItemType.ENCODED_ARRAY_ITEM:
annotators.put(mapItem.getType(), EncodedArrayItem.makeAnnotator(this, mapItem));
break;
case ItemType.ANNOTATION_DIRECTORY_ITEM:
annotators.put(mapItem.getType(), AnnotationDirectoryItem.makeAnnotator(this, mapItem));
break;
default:
throw new RuntimeException(String.format("Unrecognized item type: 0x%x", mapItem.getType()));
}
}
}