From 87c1e976167fb777641686db452c95f2e2752809 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Tue, 3 Sep 2013 12:15:13 +0200 Subject: [PATCH] Fix generator settings in XMLZipWriter. --- src/fr/devinsy/util/xml/XMLZipWriter.java | 28 +++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/fr/devinsy/util/xml/XMLZipWriter.java b/src/fr/devinsy/util/xml/XMLZipWriter.java index b6e1ebb..19cf4d3 100644 --- a/src/fr/devinsy/util/xml/XMLZipWriter.java +++ b/src/fr/devinsy/util/xml/XMLZipWriter.java @@ -18,20 +18,39 @@ import java.util.zip.ZipOutputStream; * Public License as published by the Free Software Foundation version 3 * or any later version. */ -public class XMLZipWriter extends XMLWriter { +public class XMLZipWriter extends XMLWriter +{ /** * * @param file * @throws IOException */ - public XMLZipWriter(final File file) throws IOException { + public XMLZipWriter(final File file) throws IOException + { super(); ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file)); zos.setLevel(Deflater.BEST_COMPRESSION); zos.setMethod(ZipOutputStream.DEFLATED); - zos.setComment("Generated by PUCK"); + zos.setComment("Generated by XMLZipWriter"); + zos.putNextEntry(new ZipEntry(file.getName() + ".xml")); + this.out = new PrintWriter(new OutputStreamWriter(zos, "UTF-8")); + } + + /** + * + * @param file + * @throws IOException + */ + public XMLZipWriter(final File file, final String generator) throws IOException + { + super(); + + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file)); + zos.setLevel(Deflater.BEST_COMPRESSION); + zos.setMethod(ZipOutputStream.DEFLATED); + zos.setComment(generator); zos.putNextEntry(new ZipEntry(file.getName() + ".xml")); this.out = new PrintWriter(new OutputStreamWriter(zos, "UTF-8")); } @@ -41,7 +60,8 @@ public class XMLZipWriter extends XMLWriter { * @param target * @throws IOException */ - public XMLZipWriter(final OutputStream target) throws IOException { + public XMLZipWriter(final OutputStream target) throws IOException + { super(); ZipOutputStream zos = new ZipOutputStream(target); zos.setLevel(Deflater.BEST_COMPRESSION);