From dd739bb532604f8a3d13d0cecb2788d95e6f7eae Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Wed, 11 Sep 2013 02:27:07 +0200 Subject: [PATCH] Improve method signature. --- src/fr/devinsy/util/xml/XMLZipWriter.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/fr/devinsy/util/xml/XMLZipWriter.java b/src/fr/devinsy/util/xml/XMLZipWriter.java index 19cf4d3..f89432a 100644 --- a/src/fr/devinsy/util/xml/XMLZipWriter.java +++ b/src/fr/devinsy/util/xml/XMLZipWriter.java @@ -60,13 +60,26 @@ public class XMLZipWriter extends XMLWriter * @param target * @throws IOException */ - public XMLZipWriter(final OutputStream target) throws IOException + public XMLZipWriter(final OutputStream target, final String fileName, final String generator) throws IOException { super(); ZipOutputStream zos = new ZipOutputStream(target); zos.setLevel(Deflater.BEST_COMPRESSION); zos.setMethod(ZipOutputStream.DEFLATED); - zos.putNextEntry(new ZipEntry("noname")); + if (generator != null) + { + zos.setComment(generator); + } + String entryName; + if (fileName == null) + { + entryName = "noname"; + } + else + { + entryName = fileName; + } + zos.putNextEntry(new ZipEntry(entryName)); this.out = new PrintWriter(new OutputStreamWriter(zos, "UTF-8")); } }