Search in sources :

Example 1 with ResValuesXmlSerializable

use of brut.androlib.res.xml.ResValuesXmlSerializable in project Apktool by iBotPeaches.

the class AndrolibResources method generateValuesFile.

private void generateValuesFile(ResValuesFile valuesFile, Directory out, ExtXmlSerializer serial) throws AndrolibException {
    try {
        OutputStream outStream = out.getFileOutput(valuesFile.getPath());
        serial.setOutput((outStream), null);
        serial.startDocument(null, null);
        serial.startTag(null, "resources");
        for (ResResource res : valuesFile.listResources()) {
            if (valuesFile.isSynthesized(res)) {
                continue;
            }
            ((ResValuesXmlSerializable) res.getValue()).serializeToResValuesXml(serial, res);
        }
        serial.endTag(null, "resources");
        serial.newLine();
        serial.endDocument();
        serial.flush();
        outStream.close();
    } catch (IOException | DirectoryException ex) {
        throw new AndrolibException("Could not generate: " + valuesFile.getPath(), ex);
    }
}
Also used : ResValuesXmlSerializable(brut.androlib.res.xml.ResValuesXmlSerializable) ZipOutputStream(java.util.zip.ZipOutputStream) AndrolibException(brut.androlib.AndrolibException) DirectoryException(brut.directory.DirectoryException)

Aggregations

AndrolibException (brut.androlib.AndrolibException)1 ResValuesXmlSerializable (brut.androlib.res.xml.ResValuesXmlSerializable)1 DirectoryException (brut.directory.DirectoryException)1 ZipOutputStream (java.util.zip.ZipOutputStream)1