Lesson 2 | What is an input stream? |
Objective | Examine an analogy for thinking about input streams. |
Java Stream Input Definition
Queue of People
A better analogy might be a queue of people waiting to get on a ride at an amusement park. It is the same type of line that you wait in every day to buy coffee at StarBucks or to get lunch in the cafeteria. However, a queue for a roller coaster is much longer than the lines at StarBucks, because it needs to hold more people. A queue at an amusement park is more formal, in order to move people ahead in an orderly fashion. Because these lines must hold a dozen or more people, the queue is long and usually in several sections. The length of the roller coaster queue may be adjusted for fewer people. If this were a busy day at the park, all the rows would be filled with people (elements) who would enter the line at the front of the queue,
then move forward as more and more people ride the roller coaster.
Roller Coaster Java Stream Analogy
It is important to understand the following topics in File I/O as a prerequisite for streams.
- Buffer handling
- Kernel versus user space
- Virtual memory
- Paging
- File-oriented versus stream I/O
- Multiplexed I/O (readiness selection)
New I/O versus Traditional File I/O
New I/O, usually called NIO, is a collection of Java programming language APIs that offer features for intensive I/O operations.
It was introduced with the J2SE 1.4 release of Java by Sun Microsystems to complement an existing standard I/O. NIO was developed under the Java Community Process as JSR 51. As of 2006, an extension to NIO, called NIO2 was developed under JSR 203; JSR 203 was included in Java SE 7 ("Dolphin").
What is Java Network Programming
Java Network Programming is a field of computer science that deals with the design and implementation of applications that communicate with each other over a network. It involves writing programs that can send and receive data over a network connection using the Java programming language. Network programming is an important aspect of modern computing, as it enables different devices to communicate with each other and share data. Some common applications of network programming include building web servers, creating chat applications, and building distributed systems.
Java Network Programming