public static OutputStream outputStream(String out) throws IOException {
  if (out.equals("-")) {
    return ForbiddenOk.systemDotOut();
  }
  Files.createParentDirs(new File(out));
  OutputStream stream=new BufferedOutputStream(new FileOutputStream(out));
  if (out.endsWith(".gz")) {
    stream=new GZIPOutputStream(stream);
  }
  return stream;
}

public static OutputStream outputStream ( String out ) throws IOException { if ( out . equals ( "-" ) ) { return ForbiddenOk . systemDotOut ( ) ; } Files . createParentDirs ( new File ( out ) ) ; OutputStream stream = new BufferedOutputStream ( new FileOutputStream ( out ) ) ; if ( out . endsWith ( ".gz" ) ) { stream = new GZIPOutputStream ( stream ) ; } return stream ; }
get an output stream for a file . if the file is - then returns stdin instead . if the file looks like a gzip file then zips it on the fly . also creates the file file ' s parent directories if they don ' t already exist .
