Download the JDK
Search the Tutorials
Hide the TOC
Basic I/O
I/O Streams
Byte Streams
Character Streams
Buffered Streams
Scanning and Formatting
Scanning
Formatting
I/O from the Command Line
Data Streams
Object Streams
File I/O
File Objects
Random Access Files
The New I/O Packages
Summary
Questions and Exercises
Trail: Essential Classes
Lesson: Basic I/O

> This lesson covers the Java platform classes used for basic I/O. It focuses primarily on I/O Streams, a powerful concept that greatly simplifies I/O operations. The lesson also looks at serialization, which lets a program write whole objects out to streams and read them back again. Then the lesson looks at some file system operations, including random access files. Finally, it touchs briefly on the advanced features of the New I/O API. Most of the classes covered are in the `java.io` package.

> ### I/O Streams

> > - Byte Streams handle I/O of raw binary data.
> > - Character Streams handle I/O of character data, automatically handling translation to and from the local character set.
> > - Buffered Streams optimize input and output by reducing the number of calls to the native API.
> > - Scanning and Formatting allows a program to read and write formatted text.
> > - I/O from the Command Line describes the Standard Streams and the Console object.
> > - Data Streams handle binary I/O of primitive data type and `String` values.
> > - Object Streams handle binary I/O of objects.

> ### File I/O

> > - File Objects help you to write platform-independent code that examines and manipulates files.
> > - Random Access Files handle non-sequential file access.

> ### An Overview of the New IO

> > This section talks about the advanced I/O packages added to version 1.4 of the Java Platform.

> ### Summary

> > A summary of the key points covered in this trail.

> ### Questions and Exercises

> > Test what you've learned in this trail by trying these questions and exercises.

> ### The I/O Classes in Action

> > Many of the examples in the next trail, Custom Networking use the I/O streams described in this lesson to read from and write to network connections.

> > Security consideration: Some I/O operations are subject to approval by the current security manager. The example programs contained in these lessons are standalone applications, which by default have no security manager. To work in an applet, most of these examples would have to be modified. See Security Restrictions for information about the security restrictions placed on applets.

Previous page: Previous Lesson
Next page: I/O Streams