Java Code Examples for com.android.dex.Dex#open()

The following examples show how to use com.android.dex.Dex#open() . 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: DexMerger.java    From Box with Apache License 2.0 5 votes vote down vote up
private List<UnsortedValue> readUnsortedValues(Dex source, IndexMap indexMap) {
    TableOfContents.Section section = getSection(source.getTableOfContents());
    if (!section.exists()) {
        return Collections.emptyList();
    }

    List<UnsortedValue> result = new ArrayList<UnsortedValue>();
    Dex.Section in = source.open(section.off);
    for (int i = 0; i < section.size; i++) {
        int offset = in.getPosition();
        T value = read(in, indexMap, 0);
        result.add(new UnsortedValue(source, indexMap, value, i, offset));
    }
    return result;
}
 
Example 2
Source File: DexMerger.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformAnnotationSets(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().annotationSets;
    if (section.exists()) {
        Dex.Section setIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformAnnotationSet(indexMap, setIn);
        }
    }
}
 
Example 3
Source File: DexMerger.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformAnnotationSetRefLists(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().annotationSetRefLists;
    if (section.exists()) {
        Dex.Section setIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformAnnotationSetRefList(indexMap, setIn);
        }
    }
}
 
Example 4
Source File: DexMerger.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformAnnotationDirectories(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().annotationsDirectories;
    if (section.exists()) {
        Dex.Section directoryIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformAnnotationDirectory(directoryIn, indexMap);
        }
    }
}
 
Example 5
Source File: DexMerger.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformStaticValues(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().encodedArrays;
    if (section.exists()) {
        Dex.Section staticValuesIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformStaticValues(staticValuesIn, indexMap);
        }
    }
}
 
Example 6
Source File: DexMerger.java    From Box with Apache License 2.0 5 votes vote down vote up
private List<UnsortedValue> readUnsortedValues(Dex source, IndexMap indexMap) {
    TableOfContents.Section section = getSection(source.getTableOfContents());
    if (!section.exists()) {
        return Collections.emptyList();
    }

    List<UnsortedValue> result = new ArrayList<UnsortedValue>();
    Dex.Section in = source.open(section.off);
    for (int i = 0; i < section.size; i++) {
        int offset = in.getPosition();
        T value = read(in, indexMap, 0);
        result.add(new UnsortedValue(source, indexMap, value, i, offset));
    }
    return result;
}
 
Example 7
Source File: DexMerger.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformAnnotationSets(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().annotationSets;
    if (section.exists()) {
        Dex.Section setIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformAnnotationSet(indexMap, setIn);
        }
    }
}
 
Example 8
Source File: DexMerger.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformAnnotationSetRefLists(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().annotationSetRefLists;
    if (section.exists()) {
        Dex.Section setIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformAnnotationSetRefList(indexMap, setIn);
        }
    }
}
 
Example 9
Source File: DexMerger.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformAnnotationDirectories(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().annotationsDirectories;
    if (section.exists()) {
        Dex.Section directoryIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformAnnotationDirectory(directoryIn, indexMap);
        }
    }
}
 
Example 10
Source File: DexMerger.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformStaticValues(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().encodedArrays;
    if (section.exists()) {
        Dex.Section staticValuesIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformStaticValues(staticValuesIn, indexMap);
        }
    }
}
 
Example 11
Source File: DexMerger.java    From buck with Apache License 2.0 5 votes vote down vote up
private List<UnsortedValue> readUnsortedValues(Dex source, IndexMap indexMap) {
    TableOfContents.Section section = getSection(source.getTableOfContents());
    if (!section.exists()) {
        return Collections.emptyList();
    }

    List<UnsortedValue> result = new ArrayList<UnsortedValue>();
    Dex.Section in = source.open(section.off);
    for (int i = 0; i < section.size; i++) {
        int offset = in.getPosition();
        T value = read(in, indexMap, 0);
        result.add(new UnsortedValue(source, indexMap, value, i, offset));
    }
    return result;
}
 
Example 12
Source File: DexMerger.java    From buck with Apache License 2.0 5 votes vote down vote up
private void transformAnnotationSets(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().annotationSets;
    if (section.exists()) {
        Dex.Section setIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformAnnotationSet(indexMap, setIn);
        }
    }
}
 
Example 13
Source File: DexMerger.java    From buck with Apache License 2.0 5 votes vote down vote up
private void transformAnnotationSetRefLists(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().annotationSetRefLists;
    if (section.exists()) {
        Dex.Section setIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformAnnotationSetRefList(indexMap, setIn);
        }
    }
}
 
Example 14
Source File: DexMerger.java    From buck with Apache License 2.0 5 votes vote down vote up
private void transformAnnotationDirectories(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().annotationsDirectories;
    if (section.exists()) {
        Dex.Section directoryIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformAnnotationDirectory(directoryIn, indexMap);
        }
    }
}
 
Example 15
Source File: DexMerger.java    From buck with Apache License 2.0 5 votes vote down vote up
private void transformStaticValues(Dex in, IndexMap indexMap) {
    TableOfContents.Section section = in.getTableOfContents().encodedArrays;
    if (section.exists()) {
        Dex.Section staticValuesIn = in.open(section.off);
        for (int i = 0; i < section.size; i++) {
            transformStaticValues(staticValuesIn, indexMap);
        }
    }
}