java io streams tutorial

java io streams tutorial give you on the site about the Java output streams and Java input streams. All The topics covered along with the syntax and example coding for better understanding.

Streams are a way of transferring and filtering information. Streams are directed pipes that transfer information from an input to an output.



java io streams tutorial

a stream can be built around a device that either receives or flushes information. As a simple example, keyboard interactions behave like that. It is therefore natural to use streams to treat the information flows.

Most applications need to process some input and produce some output based on that input. The purpose of the Java IO package ( is to make that possible in Java.

The terms “input” and “output” can sometimes be a bit confusing. The input of one part of an application is often the output of another. Is an Output Stream a stream where the output is written to, or output comes out from (for you to read)? After all, an Input Stream outputs its data to the reading program.

The Output Stream class is the base class of all output streams in the Java IO API. Subclasses include the Buffered Output Stream and the File Output Stream among others

Output Stream’s are used for writing byte based data, one byte at a time.

write(): The write() method of an  Output Stream takes an int which contains the byte value of the byte to write.

Subclasses of Output Stream may have alternative write() methods. For instance, the Data Output Stream allows you to write Java primitives like int, long, float, double, Boolean etc. with its corresponding methodswriteBoolean(), writeDouble() etc.


The Input Stream class is the base class (superclass) of all input streams in the Java IO API. Subclasses include the File Input Stream, Buffered Input Stream, and the Pushback Input Stream among others.

Next Page