All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.dongliu.apk.parser.struct.resource.ResourcePackage Maven / Gradle / Ivy

There is a newer version: 2.6.10
Show newest version
package net.dongliu.apk.parser.struct.resource;

import net.dongliu.apk.parser.struct.StringPool;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Resource packge.
 *
 * @author dongliu
 */
public class ResourcePackage {
    // the packageName
    public String name;
    public short id;
    // contains the names of the types of the Resources defined in the ResourcePackage
    public StringPool typeStringPool;
    //  contains the names (keys) of the Resources defined in the ResourcePackage.
    public StringPool keyStringPool;

    public ResourcePackage(PackageHeader header) {
        this.name = header.name;
        this.id = (short) header.id;
    }

    private Map typeSpecMap = new HashMap();

    private Map> typesMap = new HashMap>();

    public void addTypeSpec(TypeSpec typeSpec) {
        this.typeSpecMap.put(typeSpec.id, typeSpec);
    }

    public TypeSpec getTypeSpec(Short id) {
        return this.typeSpecMap.get(id);
    }

    public void addType(Type type) {
        List types = this.typesMap.get(type.id);
        if (types == null) {
            types = new ArrayList();
            this.typesMap.put(type.id, types);
        }
        types.add(type);
    }

    public List getTypes(Short id) {
        return this.typesMap.get(id);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy