Fix generator settings in XMLZipWriter.
This commit is contained in:
parent
8bb24ce69c
commit
87c1e97616
1 changed files with 24 additions and 4 deletions
|
@ -18,20 +18,39 @@ import java.util.zip.ZipOutputStream;
|
||||||
* Public License as published by the Free Software Foundation version 3
|
* Public License as published by the Free Software Foundation version 3
|
||||||
* or any later version.
|
* or any later version.
|
||||||
*/
|
*/
|
||||||
public class XMLZipWriter extends XMLWriter {
|
public class XMLZipWriter extends XMLWriter
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public XMLZipWriter(final File file) throws IOException {
|
public XMLZipWriter(final File file) throws IOException
|
||||||
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file));
|
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file));
|
||||||
zos.setLevel(Deflater.BEST_COMPRESSION);
|
zos.setLevel(Deflater.BEST_COMPRESSION);
|
||||||
zos.setMethod(ZipOutputStream.DEFLATED);
|
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"));
|
zos.putNextEntry(new ZipEntry(file.getName() + ".xml"));
|
||||||
this.out = new PrintWriter(new OutputStreamWriter(zos, "UTF-8"));
|
this.out = new PrintWriter(new OutputStreamWriter(zos, "UTF-8"));
|
||||||
}
|
}
|
||||||
|
@ -41,7 +60,8 @@ public class XMLZipWriter extends XMLWriter {
|
||||||
* @param target
|
* @param target
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public XMLZipWriter(final OutputStream target) throws IOException {
|
public XMLZipWriter(final OutputStream target) throws IOException
|
||||||
|
{
|
||||||
super();
|
super();
|
||||||
ZipOutputStream zos = new ZipOutputStream(target);
|
ZipOutputStream zos = new ZipOutputStream(target);
|
||||||
zos.setLevel(Deflater.BEST_COMPRESSION);
|
zos.setLevel(Deflater.BEST_COMPRESSION);
|
||||||
|
|
Loading…
Reference in a new issue