public static File writeDataToTempFile(final String data,final String ext){
  try {
    final File file=createTempFile(ext);
    final PrintWriter out=new PrintWriter(new FileOutputStream(file));
    out.print(data);
    out.close();
    return file;
  }
 catch (  IOException e) {
    JKExceptionUtil.handle(e);
    return null;
  }
}

public static File writeDataToTempFile ( final String data , final String ext ) { try { final File file = createTempFile ( ext ) ; final PrintWriter out = new PrintWriter ( new FileOutputStream ( file ) ) ; out . print ( data ) ; out . close ( ) ; return file ; } catch ( IOException e ) { JKExceptionUtil . handle ( e ) ; return null ; } }
write data to temp file .
