All About Class OutputStream in Java

OutputStream class is an abstract super class of all classes that represent an output stream of bytes.An application that need to define a subclass of OutputStream must always provide at least a method that writes one byte of output.

The class structure of OutputStream is given as:

public abstract class extends java.lang.Object{
public OutputStream();
//default constructor
public void close();//closes the input source;further read attempt on a closed input will generate
//an IOException.
public void flush();//flush the file buffer
public void write(byte b[]);//writes an entire byte array i.e block of bytes at a time.
public void write(byte b[],int offSet,int length);//write out length number of bytes from the block of 
//bytes b starting at offset offSet.
public abstract void write(int b);//writes one byte at a time
In addition,all methods may throw an IOException if an IO error occurs apart from their regular Exceptions.
All About Class OutputStream in Java All About Class OutputStream in Java Reviewed by Animesh Chatterjee on October 10, 2018 Rating: 5

No comments:

Powered by Blogger.