org.jf.dexlib2.dexbacked.util.VariableSizeLookaheadIterator Java Examples

The following examples show how to use org.jf.dexlib2.dexbacked.util.VariableSizeLookaheadIterator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DexBackedMethodImplementation.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@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);
                }
            };
        }
    };
}
 
Example #2
Source File: DexBackedMethodImplementation.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@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);
                }
            };
        }
    };
}
 
Example #3
Source File: DexBackedMethodImplementation.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@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);
                }
            };
        }
    };
}
 
Example #4
Source File: DexBackedMethodImplementation.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@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);
                }
            };
        }
    };
}