11.6 Writing and Appending to Text Files
In the previous sections, we learned how to read data from a text file. But how did the data get into the file in the first place? It could be that someone put the data into the file using a text editor, such as Notepad in Windows, or TextEdit in MacOS. Typing data into a file is convenient when the amount of data is small. But very often files contain a significant amount of data, typically written to the file by a computer program. For instance, a web server writes to log files to keep track of the visitors accessing the website, how the visitors got to the website, the time they arrived, etc. If the web server comes under attack from a hacker, these log files can be consulted to determine where the ...
Get Java Illuminated, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.