13 Streams and Files

13.1 INTRODUCTION

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.