Java Input/Output  «Prev  Next»

Lesson 2Understanding Java I/O
ObjectiveExplore the basics of Java input and output (I/O).

Understanding Java I/O

Java I/O is centered on the concept of an I/O device, which is often a physical input or output device such as a keyboard, monitor, printer, or disk drive. Although you rarely interact with a device directly, I/O devices are always implicitly associated with I/O operations.
The power of Java I/O lies in the fact that you use very similar classes and methods to read and write data regardless of the specific I/O devices. This I/O abstraction is similar to the graphics context[1] abstraction you learned about earlier in the course.

What is the function of an I/O device within the context of Java Input/Output in Java 1.1?

In the context of Java Input/Output in Java 1.1, an I/O device refers to a peripheral device such as a keyboard, mouse, display screen, or file system that can be used for input or output operations. The function of an I/O device in Java Input/Output is to provide a way for a Java program to interact with the outside world by reading from or writing to the device.
In Java 1.1, the standard way to perform I/O operations is through the java.io package, which provides a set of classes and interfaces that define the basic behavior of I/O devices and provide a consistent, platform-independent way to perform I/O operations. These classes and interfaces provide methods for reading and writing data, managing files, and performing other I/O operations in a way that is optimized for the specific type of I/O device being used.



1) Input Output 1 2) Input Output 2 3) Input Output 3
  1. Java IO abstraction is the stream, which is a medium through which data is transferred
  2. A stream acts sort of like a pipe in the real world, except that it shuttles moving data instead of water or gas
  3. Data is transferred through a stream one byte at a time, and can be directed in different ways

Java IO Streams
[1] Graphics context: A graphics context is an abstract drawing surface that is logically equivalent to a piece of paper.