List of utility methods to do ZipOutputStream Create
ZipOutputStream | getOutputStream(File file) get Output Stream return new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file))); |
OutputStream | getOutputStream(File file, boolean append) Get an output stream for a (possibly gzipped) file. OutputStream outputStream = new FileOutputStream(file, append); if (file.getName().toLowerCase().endsWith(".gz")) { outputStream = new GZIPOutputStream(outputStream); return outputStream; |
OutputStream | getOutputStream(File tarFile) If tarFile's extension is simply tar, then returns a new FileOutputStream. String name = tarFile.getName().toLowerCase(); if (name.endsWith(".tar")) { return new FileOutputStream(tarFile); } else if (name.endsWith(".tar.gz") || name.endsWith(".tgz")) { return new GZIPOutputStream(new FileOutputStream(tarFile)); } else { throw new IllegalArgumentException( "tarFile = " + tarFile.getPath() + " has an invalid extension for a tar or tar/gzip file"); ... |
OutputStream | getOutputStream(String outputFileName) get Output Stream if ("stdout".equals(outputFileName)) { return System.out; } else if ("stderr".equals(outputFileName)) { return System.err; } else if (outputFileName.endsWith(".gz")) { OutputStream out = new FileOutputStream(outputFileName); return new GZIPOutputStream(out); } else { ... |