public byte[] toByteArray() throws IOException {
        prepare();
        int size = count();
        ByteBuffer out = ByteBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN);
        write(out, size);
        return out.array();
    }
Write pkgs to an arsc file

@author bob
@see ArscParser
android/third_party/apkbuilder/src/main/java/pxb/android/arsc/ArscWriter.java