Java Code Examples for org.jf.dexlib2.dexbacked.DexReader#readSmallUleb128()

The following examples show how to use org.jf.dexlib2.dexbacked.DexReader#readSmallUleb128() . 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: StringDataItem.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) {
    return new SectionAnnotator(annotator, mapItem) {
        @Nonnull @Override public String getItemName() {
            return "string_data_item";
        }

        @Override
        protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) {
            DexReader reader = dexFile.readerAt(out.getCursor());
            int utf16Length = reader.readSmallUleb128();
            out.annotateTo(reader.getOffset(), "utf16_size = %d", utf16Length);

            String value = reader.readString(utf16Length);
            out.annotateTo(reader.getOffset() + 1, "data = \"%s\"", StringUtils.escapeString(value));
        }
    };
}
 
Example 2
Source File: StringDataItem.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) {
    return new SectionAnnotator(annotator, mapItem) {
        @Nonnull @Override public String getItemName() {
            return "string_data_item";
        }

        @Override
        protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) {
            DexReader reader = dexFile.readerAt(out.getCursor());
            int utf16Length = reader.readSmallUleb128();
            out.annotateTo(reader.getOffset(), "utf16_size = %d", utf16Length);

            String value = reader.readString(utf16Length);
            out.annotateTo(reader.getOffset() + 1, "data = \"%s\"", StringUtils.escapeString(value));
        }
    };
}
 
Example 3
Source File: StringDataItem.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) {
    return new SectionAnnotator(annotator, mapItem) {
        @Nonnull @Override public String getItemName() {
            return "string_data_item";
        }

        @Override
        protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) {
            DexReader reader = dexFile.readerAt(out.getCursor());
            int utf16Length = reader.readSmallUleb128();
            out.annotateTo(reader.getOffset(), "utf16_size = %d", utf16Length);

            String value = reader.readString(utf16Length);
            out.annotateTo(reader.getOffset() + 1, "data = \"%s\"", StringUtils.escapeString(value));
        }
    };
}
 
Example 4
Source File: AnnotationItem.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int annotationItemOffset) {
    try {
        DexReader reader = dexFile.readerAt(annotationItemOffset);
        reader.readUbyte();
        int typeIndex = reader.readSmallUleb128();
        String annotationType = dexFile.getType(typeIndex);
        return String.format("annotation_item[0x%x]: %s", annotationItemOffset, annotationType);
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
    return String.format("annotation_item[0x%x]", annotationItemOffset);
}
 
Example 5
Source File: AnnotationItem.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int annotationItemOffset) {
    try {
        DexReader reader = dexFile.readerAt(annotationItemOffset);
        reader.readUbyte();
        int typeIndex = reader.readSmallUleb128();
        String annotationType = dexFile.getType(typeIndex);
        return String.format("annotation_item[0x%x]: %s", annotationItemOffset, annotationType);
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
    return String.format("annotation_item[0x%x]", annotationItemOffset);
}
 
Example 6
Source File: DexBackedAnnotationEncodedValue.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public DexBackedAnnotationEncodedValue(@Nonnull DexReader reader) {
    this.dexFile = reader.dexBuf;
    this.type = dexFile.getType(reader.readSmallUleb128());
    this.elementCount = reader.readSmallUleb128();
    this.elementsOffset = reader.getOffset();
    skipElements(reader, elementCount);
}
 
Example 7
Source File: AnnotationItem.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int annotationItemOffset) {
    try {
        DexReader reader = dexFile.readerAt(annotationItemOffset);
        reader.readUbyte();
        int typeIndex = reader.readSmallUleb128();
        String annotationType = dexFile.getType(typeIndex);
        return String.format("annotation_item[0x%x]: %s", annotationItemOffset, annotationType);
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
    return String.format("annotation_item[0x%x]", annotationItemOffset);
}
 
Example 8
Source File: DexBackedAnnotationEncodedValue.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
public DexBackedAnnotationEncodedValue(@Nonnull DexReader reader) {
    this.dexFile = reader.dexBuf;
    this.type = dexFile.getType(reader.readSmallUleb128());
    this.elementCount = reader.readSmallUleb128();
    this.elementsOffset = reader.getOffset();
    skipElements(reader, elementCount);
}
 
Example 9
Source File: DexBackedAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public DexBackedAnnotationEncodedValue(@Nonnull DexReader reader) {
    this.dexFile = reader.dexBuf;
    this.type = dexFile.getType(reader.readSmallUleb128());
    this.elementCount = reader.readSmallUleb128();
    this.elementsOffset = reader.getOffset();
    skipElements(reader, elementCount);
}
 
Example 10
Source File: DexBackedAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public DexBackedAnnotationEncodedValue(@Nonnull DexReader reader) {
    this.dexFile = reader.dexBuf;
    this.type = dexFile.getType(reader.readSmallUleb128());
    this.elementCount = reader.readSmallUleb128();
    this.elementsOffset = reader.getOffset();
    skipElements(reader, elementCount);
}
 
Example 11
Source File: DexBackedArrayEncodedValue.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public static void skipFrom(@Nonnull DexReader reader) {
    int elementCount = reader.readSmallUleb128();
    skipElementsFrom(reader, elementCount);
}
 
Example 12
Source File: DexBackedAnnotationEncodedValue.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public static void skipFrom(@Nonnull DexReader reader) {
    reader.skipUleb128(); // type
    int elementCount = reader.readSmallUleb128();
    skipElements(reader, elementCount);
}
 
Example 13
Source File: DexBackedArrayEncodedValue.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public DexBackedArrayEncodedValue(@Nonnull DexReader reader) {
    this.dexFile = reader.dexBuf;
    this.elementCount = reader.readSmallUleb128();
    this.encodedArrayOffset = reader.getOffset();
    skipElementsFrom(reader, elementCount);
}
 
Example 14
Source File: DexBackedArrayEncodedValue.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public DexBackedArrayEncodedValue(@Nonnull DexReader reader) {
    this.dexFile = reader.dexBuf;
    this.elementCount = reader.readSmallUleb128();
    this.encodedArrayOffset = reader.getOffset();
    skipElementsFrom(reader, elementCount);
}
 
Example 15
Source File: DexBackedArrayEncodedValue.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public static void skipFrom(@Nonnull DexReader reader) {
    int elementCount = reader.readSmallUleb128();
    skipElementsFrom(reader, elementCount);
}
 
Example 16
Source File: DexBackedAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public static void skipFrom(@Nonnull DexReader reader) {
    reader.skipUleb128(); // type
    int elementCount = reader.readSmallUleb128();
    skipElements(reader, elementCount);
}
 
Example 17
Source File: DexBackedAnnotationEncodedValue.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public static void skipFrom(@Nonnull DexReader reader) {
    reader.skipUleb128(); // type
    int elementCount = reader.readSmallUleb128();
    skipElements(reader, elementCount);
}
 
Example 18
Source File: DexBackedArrayEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public DexBackedArrayEncodedValue(@Nonnull DexReader reader) {
    this.dexFile = reader.dexBuf;
    this.elementCount = reader.readSmallUleb128();
    this.encodedArrayOffset = reader.getOffset();
    skipElementsFrom(reader, elementCount);
}
 
Example 19
Source File: DexBackedArrayEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public DexBackedArrayEncodedValue(@Nonnull DexReader reader) {
    this.dexFile = reader.dexBuf;
    this.elementCount = reader.readSmallUleb128();
    this.encodedArrayOffset = reader.getOffset();
    skipElementsFrom(reader, elementCount);
}
 
Example 20
Source File: DexBackedArrayEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public static void skipFrom(@Nonnull DexReader reader) {
    int elementCount = reader.readSmallUleb128();
    skipElementsFrom(reader, elementCount);
}