Java Programing laungage

Java Input Output Projects

Java I/O Project 1

Java Input Output Examples

Java Input Output Examples

Java IO
Previous Home Next

Introduction

The java Input and Out Put is a Part of the java. this package contain the input stream and output stream. The input stream is used to defined for the reading the stream , byte stream and array of the stream. and output stream write the stream which is come from internal memory to output stream. all these package contain into the java.io.* package. the java.io.*contain the large number of the classes, which is help in the Input and output operation.

InputStream

The InputStream class is used for data reading such as stream, byte stream, array of the stream from an input source. And this input source can be a string, file, or memory that contain the data.

Input stream is an abstract class which is contain some subclass that subclass support the java input in program. they are byte array input stream, file input stream, object input stream, filter input stream, pipe input stream, sequence input stream and string buffer input stream. when we are create stream it is automatically open. we can close explicitly a stream with the close( )method, or it be closed implicitly when the object is found as a garbage.

OutputStream

The outputstream class is a class which is contain into the java.io.* package. it is contain the many subclasses that support to the writing data such as byte, array of byte to an output source. Similar to input sources, an output source is also contain the data in a form of a file, a string, or memory .

The subclass are ByteArrayOutputStream, FileoutputStream, FilterOutputStream, ObjectOutputStream and PipedOutputStream. Like an input stream, an output stream when we are create the output stream it is automatically open. we can explicitly close an output stream by the close( ) method, or it be closed automatically when the object is garbage collected.

How the Files and Streams Work

The Java uses input and output streams to handle I/O operation by which the data are flowing from one place to another place. For example, In the Input and Output Stream, the data is flow from the disk-file to input stream. this is read the file and flow the data into the internal memory and then flow to Output Stream for write the data and stored into the disk-file.

The disk-file may be a text file or a binary file. When we work with a text file, we are use character stream where is the characters treated as per byte on disk. and when we are working with a binary file, then we are using a binary stream.

Previous Home Next