2016-07-24
1,bufferedwriter
Debug
F5 Entry Method
F6 executes the next line of code
F7 Exit method
F8 jumps to the next breakpoint
Packagecom.java1995;ImportJava.io.BufferedReader;ImportJava.io.BufferedWriter;Importjava.io.FileNotFoundException;ImportJava.io.FileReader;ImportJava.io.FileWriter;Importjava.io.IOException; Public classCopyFile { Public Static voidMain (string[] args) {//shortcut keys for importing packages Ctrl+shift+oFileReader FR =NULL; FileWriter FW=NULL; BufferedReader BR=NULL; BufferedWriter BW=NULL; Try{FR=NewFileReader ("C:\\java1995\\workspace_se_2\\day17\\src\\com\\java1995\\copyfile.java"); FW=NewFileWriter ("C:\\java1995\\workspace_se_2\\day17\\src\\out.txt"); BR=NewBufferedReader (FR); Bw=NewBufferedWriter (FW); intc = 0; while((c = Br.read ())! = 1) {bw.write (c); //Bw.flush ();} bw.flush (); } Catch(FileNotFoundException e) {//TODO auto-generated Catch blockE.printstacktrace (); } Catch(IOException e) {//TODO auto-generated Catch blockE.printstacktrace (); } finally { Try{fr.close (); Fw.close (); Br.close (); Bw.close (); } Catch(IOException e) {//TODO auto-generated Catch blockE.printstacktrace (); } } }}
Resources
[1] Java Easy Start Classic tutorial "full version"
Javase Advanced Section 17th write buffer class BufferedWriter