private PrintStream newStream ( String name ) throws IOException { if ( LOG . isDebuggingFiner ( ) ) { LOG . debugFiner ( "Requested stream: " + name ) ; } // Ensure the directory exists: if ( ! basename . exists ( ) ) { basename . mkdirs ( ) ; } String fn = basename . getAbsolutePath ( ) + File . separator + name + EXTENSION ; fn = usegzip ? fn + GZIP_EXTENSION : fn ; OutputStream os = new FileOutputStream ( fn ) ; if ( usegzip ) { // wrap into gzip stream. os = new GZIPOutputStream ( os ) ; } PrintStream res = new PrintStream ( os ) ; if ( LOG . isDebuggingFiner ( ) ) { LOG . debugFiner ( "Opened new output stream:" + fn ) ; } // cache. return res ; }
Open a new stream of the given name