public static File copy(Reader reader) throws IOException
  {
    File file = createTempFile();
    copy(reader, new FileWriter(file));
    return file;
  }
public static File copy ( Reader reader ) throws IOException { File file = createTempFile ( ) ; copy ( reader , new FileWriter ( file ) ) ; return file ; }
Copy text from character stream to temporary file then close both the source reader and temporary file. Be aware
that temporary file is removed at JVM exit.

@param reader source character reader.
@return the newly created temporarily file.
@throws IOException if copy operation fails.