Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

PipedOutputStream in Java
PipedOutputStream in Java

PipedOutputStream in Java:

A PipedOutputStream is the transmitting end of a communication channel through pipe.Any information we write to this automatically ends up as input (or the associated PipedInputStream) implements the piping concept). Two threads can communicate by having one thread send the data through PipedInputStream and other thread read data through a PipedOutputStream. The constructor of PipedOutputStream takes argument as PipedInputStream.
It is used to designate the destination of our data for multithreading connect it to a FileterOutputStream object to provide a useful interface.

The class structure of PipedOutputStream is given as:


public class java.io.PipedOutputStream extends java.io.OutputStream{
//constructors
public PipedOutputStream();
//creates a PipedInputStream which is not yet connected to a PipedInputStream. It needs to be
//connected to a PipedInputStream either by the receiver or the sender before being used.
public PipedOutputStream(PipedInputStream stm);
//creates a PipedInputStream which is connected to a PipedOutputStream stm.
//methods
public void close();
public void connect(PipedInputStream stm);
public void write(int b);
public void write(byte b[],int offSet,int length);
}

In addition, all methods may throw an IOException if an IO error occurs apart from their regular Exceptions.


Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

LEAVE A REPLY

Please enter your comment!
Please enter your name here