public static String createTempFile(final String... lines) throws Exception {
  final File f=File.createTempFile("LDIFBasedTestCase",".txt");
  f.deleteOnExit();
  try (final FileWriter w=new FileWriter(f)){
    for (    final String s : lines) {
      w.write(s + System.getProperty("line.separator"));
    }
  }
   return f.getAbsolutePath();
}

public static String createTempFile ( final String ... lines ) throws Exception { final File f = File . createTempFile ( "LDIFBasedTestCase" , ".txt" ) ; f . deleteOnExit ( ) ; try ( final FileWriter w = new FileWriter ( f ) ) { for ( final String s : lines ) { w . write ( s + System . getProperty ( "line.separator" ) ) ; } } return f . getAbsolutePath ( ) ; }
creates a temporary text file with the specified contents . it will be marked for automatic deletion when the jvm exits .
