public Writer open ( ) throws IOException { switch ( state ) { case OPEN : throw new IllegalStateException ( "File " + tempFile + " is already open." ) ; case CLOSED : throw new IllegalStateException ( "File " + tempFile + " has been closed already." ) ; default : // READY state = State . OPEN ; tempFile . createNewFile ( ) ; fileWriter = new FileWriter ( tempFile ) ; return fileWriter ; } }
Create the file with its in progress filename .