0

Please explain the use of Java's InputStream and OutputStream classes. I'm confused.

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Thiyagu ATR
  • 2,224
  • 7
  • 30
  • 44

3 Answers3

3

You can't get better explanation than this.

Summary:

InputStream: The abstract class; superclass of all classes representing an input stream of bytes.

enter image description here

OutputStream: This abstract class is the superclass of all classes representing an output stream of bytes. An output stream accepts output bytes and sends them to some sink.

enter image description here

Some more details are available here.

To know about Character Streams, see here and here.

Community
  • 1
  • 1
Azodious
  • 13,752
  • 1
  • 36
  • 71
2

The goal of InputStream and OutputStream is to abstract different ways to input and output: whether the stream is a file, a web page, or the screen shouldn't matter. All that matters is that you receive information from the stream (or send information into that stream.)

InputStream is used for many things that you read from.

OutputStream is used for many things that you write to.

Srinivas B
  • 1,821
  • 4
  • 17
  • 35
-1

An I/O Stream represents an input source or an output destination. A stream can represent many different kinds of sources and destinations, including disk files, devices, other programs, and memory arrays.

Devesh
  • 85
  • 9