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 .