Java Utililty Methods ZipOutputStream Create

List of utility methods to do ZipOutputStream Create

Description

The list of methods to do ZipOutputStream Create are organized into topic(s).

Method

ZipOutputStreamgetOutputStream(File file)
get Output Stream
return new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
OutputStreamgetOutputStream(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;
OutputStreamgetOutputStream(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");
...
OutputStreamgetOutputStream(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 {
...