Java Streams  «Prev 

Roller Coaster Java Stream Analogy

Picture a line of people waiting to get on a roller coaster. As people get on the roller coaster, more people are added at the back of the line. If it's a slow day, the roller coaster may catch up with the end of the line and have to wait for people to board.
Other days, there may always be people in line until the park closes.
Each person is a discrete individual and must be put on the roller coaster or not put on the roller coaster. There are no half-people. There is always a definite number of people in line, though this number may change from moment to moment as people enter at the back of the line and exit from the front of the line. Although all the people are discrete, you will sometimes have a family that must be put together in the same car. Thus even though the individuals are discrete, they are not necessarily unrelated.
  1. If data flows from a source into a program, it is called an input streams.
  2. If data flows from a program to a destination, it is called an output stream.
  3. The basic stream classes are defined in the package "java.io".

I/O streams carry data.

Text streams have character data such as an HTML file or a Java source file. Binary streams have byte data that may represent a graphic or executable code, such as a Java .class file. A stream carries data from a source to a destination in FIFO mode.

Final Destination Roller Coaster

This browser does not support the video element.