private void readPackage(ByteBuffer in) throws IOException {
        int pid = in.getInt() % 0xFF;

        String name;
        {
            int nextPisition = in.position() + 128 * 2;
            StringBuilder sb = new StringBuilder(32);
            for (int i = 0; i < 128; i++) {
                int s = in.getShort();
                if (s == 0) {
                    break;
                } else {
                    sb.append((char) s);
                }
            }
            name = sb.toString();
            in.position(nextPisition);
        }

        pkg = new Pkg(pid, name);
        pkgs.add(pkg);

        int typeStringOff = in.getInt();
        int typeNameCount = in.getInt();
        int keyStringOff = in.getInt();
        int specNameCount = in.getInt();

        {
            Chunk chunk = new Chunk();
            if (chunk.type != RES_STRING_POOL_TYPE) {
                throw new RuntimeException();
            }
            typeNamesX = StringItems.read(in);
            in.position(chunk.location + chunk.size);
        }
        {
            Chunk chunk = new Chunk();
            if (chunk.type != RES_STRING_POOL_TYPE) {
                throw new RuntimeException();
            }
            keyNamesX = StringItems.read(in);
            if (DEBUG) {
                for (int i = 0; i < keyNamesX.length; i++) {
                    D("STR [%08x] %s", i, keyNamesX[i]);
                }
            }
            in.position(chunk.location + chunk.size);
        }

        out:
        while (in.hasRemaining()) {
            Chunk chunk = new Chunk();
            switch (chunk.type) {
                case RES_TABLE_TYPE_SPEC_TYPE: {
                    D("[%08x]read spec", in.position() - 8);
                    int tid = in.get() & 0xFF;
                    in.get(); // res0
                    in.getShort();// res1
                    int entryCount = in.getInt();

                    Type t = pkg.getType(tid, typeNamesX[tid - 1], entryCount);
                    for (int i = 0; i < entryCount; i++) {
                        t.getSpec(i).flags = in.getInt();
                    }
                }
                break;
                case RES_TABLE_TYPE_TYPE: {
                    D("[%08x]read config", in.position() - 8);
                    int tid = in.get() & 0xFF;
                    in.get(); // res0
                    in.getShort();// res1
                    int entryCount = in.getInt();
                    Type t = pkg.getType(tid, typeNamesX[tid - 1], entryCount);
                    int entriesStart = in.getInt();

                    D("[%08x]read config id", in.position());

                    int p = in.position();
                    int size = in.getInt();
                    // readConfigFlags();
                    byte[] data = new byte[size];
                    in.position(p);
                    in.get(data);
                    Config config = new Config(data, entryCount);

                    in.position(chunk.location + chunk.headSize);

                    D("[%08x]read config entry offset", in.position());

                    int[] entrys = new int[entryCount];
                    for (int i = 0; i < entryCount; i++) {
                        entrys[i] = in.getInt();
                    }
                    D("[%08x]read config entrys", in.position());
                    for (int i = 0; i < entrys.length; i++) {
                        if (entrys[i] != -1) {
                            in.position(chunk.location + entriesStart + entrys[i]);
                            ResSpec spec = t.getSpec(i);
                            readEntry(config, spec);
                        }
                    }

                    t.addConfig(config);
                }
                break;
                default:
                    break out;
            }
            in.position(chunk.location + chunk.size);
        }
    }
If set, this is a complex entry, holding a set of name/value mappings. It
is followed by an array of ResTable_map structures.
android/third_party/apkbuilder/src/main/java/pxb/android/arsc/ArscParser.java