21

Java IO Files

LEARNING OBJECTIVES

At the end of the chapter, you will be able to understand and program

  • Concepts of Streams and Stream classes.
  • Use InputStream and OutputStream.
  • Random file handling.
  • File IO and Errors and Exception in File IO.
  • Handling of primitive data types with DataInputStreams & DataOutputStreams.
  • Read objects from and write objects on to a file.
  • Object Streams and Piped Streams.

21.1 Introduction

We have all heard about streams of water; we call them springs flowing from top of hills to plains. In Java, flow of data from output device to computer system and computer to any one of the output devices is called Stream or IO streams.

This chapter will introduce you to concepts of IOStreaming and stream classes like ...

Get Object-oriented Programming Using C++ and Java 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.