code: protected OutputStream getOutputStream(boolean useStdOut, String filePath,
  			String compressionType) throws IOException {
  		if (useStdOut) {
  			return System.out;
  		}
  
  		if (!compressionType.isEmpty()) {
  			filePath += "." + compressionType;
  		}
  
  		Path outputDirectory = Paths.get(filePath).getParent();
  		if (outputDirectory == null) {
  			outputDirectory = Paths.get(".");
  		}
  
  		DirectoryManager dm = DirectoryManagerFactory.createDirectoryManager(
  				outputDirectory, false);
  		OutputStream out = dm.getOutputStreamForFile(Paths.get(filePath)
  				.getFileName().toString());
  
  		OutputStream bufferedFileOutputStream = new BufferedOutputStream(out,
  				1024 * 1024 * 5);
  
  		switch (compressionType) {
  		case COMPRESS_BZ2:
  			return getAsynchronousOutputStream(new BZip2CompressorOutputStream(
  					bufferedFileOutputStream));
  		case COMPRESS_GZIP:
  			GzipParameters gzipParameters = new GzipParameters();
  			gzipParameters.setCompressionLevel(7);
  			return getAsynchronousOutputStream(new GzipCompressorOutputStream(
  					bufferedFileOutputStream, gzipParameters));
  		case COMPRESS_NONE:
  			return bufferedFileOutputStream;
  		default:
  			bufferedFileOutputStream.close();
  			throw new IllegalArgumentException(
  					"Unsupported compression format: " + compressionType);
  		}
  	}
docs: Creates an compressing {@link OutputStream}. The result is owned by the
  caller and should be closed later. Neverhteless, the {@link #close()}
  method of this class must also be called, since it may free additional
  resources created.
  
  @param useStdOut
  if true, {@link System#out} is returned and the other
  parameters are ignored
  @param filePath
  the string name of the output file, possibly including path
  information
  @param compressionType
  a string that refers to a type of output compression or the
  empty string (no compression); a suitable file extension will
  be added to the output file
  
  @return compressing {@link OutputStream}
  @throws IOException
  if there were problems opening the required streams