PipedInputStream
The Java.io.PipedInputStream class is a piped input stream that can be connected to a piped output stream, the piped input stream then provides whatever data bytes are written to the piped output stream.Following are the important points about PipedInputStream:
* The piped input stream contains a buffer, decoupling read operations from write operations, within limits.
* Attempting to use both objects from a single thread is not recommended, as it may deadlock the thread.
* A pipe is said to be broken if a thread that was providing data bytes to the connected piped output stream is no longer alive.
Sno | Method & Description |
---|---|
1 |
int available() This method returns the number of bytes that can be read from this input stream without blocking. |
2 |
void close() This method closes this piped input stream and releases any system resources associated with the stream. |
3 |
void connect(PipedOutputStream src) This method causes this piped input stream to be connected to the piped output stream src. |
4 |
int read() This method reads the next byte of data from this piped input stream. |
5 |
int read(byte[] b, int off, int len) This method reads up to len bytes of data from this piped input stream into an array of bytes. |
6 |
protected void receive(int b) This method receives a byte of data. |