code: public static File writeToTempFile(String buf, String prefix, String suffix) throws IOException {
  
          InputStream is = new ByteArrayInputStream(buf.getBytes("UTF-8"));
          return writeToTempFile(is, prefix, suffix);
      }
docs: Writes from a String to a temporary file