Here you can find the source of getOutputStream(String outputFileName)
public static OutputStream getOutputStream(String outputFileName) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.zip.GZIPOutputStream; public class Main { public static OutputStream getOutputStream(String outputFileName) throws IOException { 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 {//from ww w .ja v a 2 s .c o m return new FileOutputStream(outputFileName); } } }