Search in sources :

Example 1 with CloseProtectedZipInputStream

use of org.hl7.fhir.utilities.CloseProtectedZipInputStream in project kindling by HL7.

the class Publisher method minify.

private void minify(String srcFile, String dstFile) throws Exception {
    CloseProtectedZipInputStream source = new CloseProtectedZipInputStream(new FileInputStream(srcFile));
    ZipGenerator dest = new ZipGenerator(dstFile);
    ZipEntry entry = null;
    while ((entry = source.getNextEntry()) != null) {
        String name = entry.getName();
        if (name.endsWith(".xsd"))
            dest.addStream(entry.getName(), stripXsd(source), false);
        else if (name.endsWith(".json") && !name.endsWith(".schema.json"))
            dest.addStream(entry.getName(), stripJson(source), false);
        else if (name.endsWith(".xml"))
            dest.addStream(entry.getName(), stripXml(source), false);
        else
            dest.addStream(entry.getName(), source, false);
    }
    source.actualClose();
    dest.close();
}
Also used : ZipEntry(java.util.zip.ZipEntry) ZipGenerator(org.hl7.fhir.utilities.ZipGenerator) CSFileInputStream(org.hl7.fhir.utilities.CSFileInputStream) FileInputStream(java.io.FileInputStream) CloseProtectedZipInputStream(org.hl7.fhir.utilities.CloseProtectedZipInputStream)

Aggregations

FileInputStream (java.io.FileInputStream)1 ZipEntry (java.util.zip.ZipEntry)1 CSFileInputStream (org.hl7.fhir.utilities.CSFileInputStream)1 CloseProtectedZipInputStream (org.hl7.fhir.utilities.CloseProtectedZipInputStream)1 ZipGenerator (org.hl7.fhir.utilities.ZipGenerator)1