public void writeDataFile(String filename) throws DataFileException {
  File outFile=new File(filename);
  FileOutputStream fos=null;
  try {
    fos=new FileOutputStream(outFile);
  }
 catch (  FileNotFoundException e) {
    throw new DataFileException("Could not open file " + filename,e);
  }
  try {
    writeDataFile(fos);
  }
  finally {
    try {
      if (fos != null)       fos.close();
    }
 catch (    IOException e) {
      throw new DataFileException("Could not close file " + filename + ", may not have written correctly;",e);
    }
  }
}

public void writeDataFile ( String filename ) throws DataFileException { File outFile = new File ( filename ) ; FileOutputStream fos = null ; try { fos = new FileOutputStream ( outFile ) ; } catch ( FileNotFoundException e ) { throw new DataFileException ( "Could not open file " + filename , e ) ; } try { writeDataFile ( fos ) ; } finally { try { if ( fos != null ) fos . close ( ) ; } catch ( IOException e ) { throw new DataFileException ( "Could not close file " + filename + ", may not have written correctly;" , e ) ; } } }
writes the records in this datafile object to a text data file
