Java Streams   «Prev  Next»

Lesson 1

Classic Java Streams for Input and Output

Java Streams is the first course in the Networking with Java series. Java programs perform I/O through streams. A stream is an abstraction that either produces or consumes information. A stream is linked to a physical device by the Java I/O system. All streams behave in the same manner, even if the actual physical devices to which they are linked differ. Thus, the same I/O classes and methods can be applied to any type of device. This means that an input stream can abstract many different kinds of input: from a disk file, a keyboard, or a network socket. Likewise, an output stream may refer to the console, a disk file, or a network connection.
Streams are a clean way to deal with input/output without having every part of your code understand the difference between a keyboard and a network, for example. Java implements streams within class hierarchies defined in the java.io package.
This course teaches you how to
  1. read and write data to files,
  2. System.out, and
  3. System.in
using streams.
After completing this course, you will be able to
  1. Efficiently read data from a stream and write data to a stream
  2. Flush and close an output stream
  3. Use file streams
  4. Read and write formatted numeric data
  5. Buffer streams for improved performance
  6. Connect input and output streams and connect multiple input streams
  7. Read and write byte arrays through the streams mechanism

What is a Java Stream?

A stream is an ordered sequence of data that,
  1. Provides a common I/O model
  2. Abstracts details from an underlying source or destination
Whether you use streams to take data from memory, storage, or your network, it will hide the implementation details from you. The details are abstracted away, so in each scenario, you can look at it as an ordered sequence of data.
While Java Streams does not deal directly with network programming, it covers skills that are prerequisite for anyone interested in writing programs that communicate over networks.
The Networking with Java series progresses from courses teaching these prerequisite skills to courses dealing specifically with writing Java programs that communicate over networks.

Java Streams Course length

This course should take you approximately 15 hours to complete. You can expect to spend 15 to 30 minutes on each lesson. Some lessons will take you longer, especially if there is an exercise to submit, and others may take 10 minutes. These numbers are only estimates. Remember that your pace through the course is entirely up to you.
In the next lessons, the course prerequisites and the course project will be discussed.

Java Lambdas and Parallel Streams