Chapter 10

Performing I/O

Applications often input data for processing and output processing results. Data is input from a file or some other source, and is output to a file or some other destination. Java supports I/O via the classic I/O APIs located in the java.io package. This chapter introduces you to java.io's File, RandomAccessFile, stream, and writer/reader classes.

File

File-oriented I/O activities often interact with a filesystem, which is typically expressed as a hierarchy of files and directories starting from a root directory. The underlying platform on which a Java virtual machine runs may support zero or more filesystems.

For example, a Unix or Linux platform combines all mounted (attached and prepared) disks into a single virtual ...

Get Learn Java for Android Development 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.