org.jf.util.AlignmentUtils Java Examples

The following examples show how to use org.jf.util.AlignmentUtils. 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: SectionAnnotator.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
protected void annotateSectionInner(@Nonnull AnnotatedBytes out, int itemCount) {
    String itemName = getItemName();
    int itemAlignment = getItemAlignment();
    if (itemCount > 0) {
        out.annotate(0, "");
        out.annotate(0, "-----------------------------");
        out.annotate(0, "%s section", itemName);
        out.annotate(0, "-----------------------------");
        out.annotate(0, "");

        for (int i=0; i<itemCount; i++) {
            out.moveTo(AlignmentUtils.alignOffset(out.getCursor(), itemAlignment));

            String itemIdentity = getItemIdentity(out.getCursor());
            if (itemIdentity != null) {
                out.annotate(0, "[%d] %s: %s", i, itemName, itemIdentity);
            } else {
                out.annotate(0, "[%d] %s", i, itemName);
            }
            out.indent();
            annotateItem(out, i, itemIdentity);
            out.deindent();
        }
    }
}
 
Example #2
Source File: SectionAnnotator.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
protected void annotateSectionInner(@Nonnull AnnotatedBytes out, int itemCount) {
    String itemName = getItemName();
    int itemAlignment = getItemAlignment();
    if (itemCount > 0) {
        out.annotate(0, "");
        out.annotate(0, "-----------------------------");
        out.annotate(0, "%s section", itemName);
        out.annotate(0, "-----------------------------");
        out.annotate(0, "");

        for (int i=0; i<itemCount; i++) {
            out.moveTo(AlignmentUtils.alignOffset(out.getCursor(), itemAlignment));

            String itemIdentity = getItemIdentity(out.getCursor());
            if (itemIdentity != null) {
                out.annotate(0, "[%d] %s: %s", i, itemName, itemIdentity);
            } else {
                out.annotate(0, "[%d] %s", i, itemName);
            }
            out.indent();
            annotateItem(out, i, itemIdentity);
            out.deindent();
        }
    }
}
 
Example #3
Source File: SectionAnnotator.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
protected void annotateSectionInner(@Nonnull AnnotatedBytes out, int itemCount) {
    String itemName = getItemName();
    int itemAlignment = getItemAlignment();
    if (itemCount > 0) {
        out.annotate(0, "");
        out.annotate(0, "-----------------------------");
        out.annotate(0, "%s section", itemName);
        out.annotate(0, "-----------------------------");
        out.annotate(0, "");

        for (int i=0; i<itemCount; i++) {
            out.moveTo(AlignmentUtils.alignOffset(out.getCursor(), itemAlignment));

            String itemIdentity = getItemIdentity(out.getCursor());
            if (itemIdentity != null) {
                out.annotate(0, "[%d] %s: %s", i, itemName, itemIdentity);
            } else {
                out.annotate(0, "[%d] %s", i, itemName);
            }
            out.indent();
            annotateItem(out, i, itemIdentity);
            out.deindent();
        }
    }
}
 
Example #4
Source File: SectionAnnotator.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
protected void annotateSectionInner(@Nonnull AnnotatedBytes out, int itemCount) {
    String itemName = getItemName();
    int itemAlignment = getItemAlignment();
    if (itemCount > 0) {
        out.annotate(0, "");
        out.annotate(0, "-----------------------------");
        out.annotate(0, "%s section", itemName);
        out.annotate(0, "-----------------------------");
        out.annotate(0, "");

        for (int i=0; i<itemCount; i++) {
            out.moveTo(AlignmentUtils.alignOffset(out.getCursor(), itemAlignment));

            String itemIdentity = getItemIdentity(out.getCursor());
            if (itemIdentity != null) {
                out.annotate(0, "[%d] %s: %s", i, itemName, itemIdentity);
            } else {
                out.annotate(0, "[%d] %s", i, itemName);
            }
            out.indent();
            annotateItem(out, i, itemIdentity);
            out.deindent();
        }
    }
}
 
Example #5
Source File: DexBackedMethodImplementation.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #6
Source File: DexBackedMethodImplementation.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #7
Source File: DexBackedMethodImplementation.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #8
Source File: DexBackedMethodImplementation.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@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();
}