COMP 249 Lecture 10: FileIO10.java

80 views5 pages

Document Summary

// fileio10. java by: aiman hanna (c) 1993 - 2017. // this program provides a pre-introduction to the file class. // he program actually does not introduce that class; rather it. // do you see the type of damages that such coding combined with. // a small careless, or possibly intentionally, input from user. // 1) the file class. import java. util. scanner; import java. io. printwriter; import java. io. fileoutputstream; import java. io. filenotfoundexception; import java. io. fileinputstream; import java. io. bufferedreader; import java. io. filereader; import java. io. ioexception; public class fileio10{ outfilestreamname. println(s); s = infilestreamname. readline(); throws ioexception. // a method that the names of an input and output files (as streams) // then copies the input file to the output file public static void filecopy(bufferedreader infilestreamname, printwriter outfilestreamname) // read line by line from input file and copy it to output file. String s; s = infilestreamname. readline(); while(s != null) // the readline() method returns null when it is eof. // must close the files to flush the buffers infilestreamname. close(); outfilestreamname. close();

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents