13 Streams and Files


A stream is a sequence of bytes. When data is received by some device (e.g., a keyboard to the program), the stream is termed as input stream and when data is sent by the program to the output device (e.g., a screen), the stream is termed as output stream. A stream provides a sort of abstraction as will be seen. All streams behave in the same manner whether data come from some device (e.g., from a keyboard or from some network socket). Similar argument applies for output stream. It behaves the same for screen, network socket or any other output device. We have mentioned in all the earlier programs that for printing something onto the screen we have made use of System.out.println . Similarly for taking ...

Get Java Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.