© Adam L. Davis 2020
Adam L. DavisModern Programming Made Easyhttps://doi.org/10.1007/978-1-4842-5569-8_15

15. Input/Output

Adam L. Davis
(1)
Oviedo, FL, USA
 
Many times when developing an application, you need to read or write from files or a network connection. These things are generally referred to as input and output or I/O for short.
In this chapter, we will cover some of the utilities available for I/O within Java and the JVM.

Files

In Java, the java.io.File class is used to represent files and directories. For example:
1   File file = new  File("path/file.txt");
2   File dir = new File("path/"); //directory
Java 7 added several new classes and interfaces for manipulating files and file systems under the java.nio package. This new application program ...

Get Modern Programming Made Easy: Using Java, Scala, Groovy, and JavaScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.