code: public static File writeStringToTempFile(String prefix, String suffix, String data) throws IOException {
          File testFile = File.createTempFile(prefix, suffix);
  
          BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
                  testFile.getAbsoluteFile(), false),DataUtilDefaults.charSet));
          writer.write(data);
          writer.flush();
          writer.close();
          return testFile;
      }
docs: This method writes all data from a string to a temp file. The file will be automatically deleted on JVM shutdown.
  @param prefix file prefix i.e. "abc" in abc.txt
  @param suffix file suffix i.e. ".txt" in abc.txt
  @param data string containing the data to write to the file
  @return <code>File</code> object
  @throws IOException IO exception