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

15. Input/Output

Adam L. Davis1 
(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 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.