All About Class PipedInputStream in Java

0
21
Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

PipedInputStream in Java
PipedInputStream in Java

PipedInputStream in Java:

A PipedInputStream is the receiving end of the communication pipe.two threads can communicate by having one thread send the data through PipedInputStream  and other thread read data through a PipedOutputStream.
The constructor of PipedInputStream accepts PipedOutputStream as an argument to process the data. As a source of data in multi threading ,We need to connect it to FilterInputStream object to provide a useful interface.

The class PipedInputStream is given as:


public class java.io.PipedInputStream extends java.io.InputStream{
//constructors
public PipedInputStream();
//creates a PipedInputStream which is not yet connected to a PipedOutputStream. It needs to be 
//connected to a PipedOutputStream either by the receiver or the sender before being used.
public PipedInputStream(PipedOutputStream src);
//creates a PipedInputStream which is connected to a PipedOutputStream src..It may throw
//IOException if an I/o error occurs.
//methods
public void close();
public void connect(PipedOutputStream src);
public int read();
public int read(byte b[],int offSet,int length);
}
 

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

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here