public void write ( ) { root . accept ( visitor ) ; try { Backup . backup ( root . getFilename ( ) ) ; } catch ( IOException e ) { logger . error ( "Problem backing up old copy of GEDCOM file" , e ) ; } final String filename = root . getFilename ( ) ; final String charset = new CharsetScanner ( ) . charset ( root ) ; try ( FileOutputStream fstream = new FileOutputStream ( filename ) ; BufferedOutputStream bstream = new BufferedOutputStream ( fstream ) ) { writeTheLines ( bstream , charset ) ; } catch ( IOException e ) { logger . error ( "Problem writing GEDCOM file" , e ) ; } }
Write the file as directed .