- Java.io package classes
- Java.io - Home
- Java.io - BufferedInputStream
- Java.io - BufferedOutputStream
- Java.io - BufferedReader
- Java.io - BufferedWriter
- Java.io - ByteArrayInputStream
- Java.io - ByteArrayOutputStream
- Java.io - CharArrayReader
- Java.io - CharArrayWriter
- Java.io - Console
- Java.io - DataInputStream
- Java.io - DataOutputStream
- Java.io - File
- Java.io - FileDescriptor
- Java.io - FileInputStream
- Java.io - FileOutputStream
- Java.io - FilePermission
- Java.io - FileReader
- Java.io - FileWriter
- Java.io - FilterInputStream
- Java.io - FilterOutputStream
- Java.io - FilterReader
- Java.io - FilterWriter
- Java.io - InputStream
- Java.io - InputStreamReader
- Java.io - LineNumberInputStream
- Java.io - LineNumberReader
- Java.io - ObjectInputStream
- Java.io - ObjectInputStream.GetField
- Java.io - ObjectOutputStream
- io - ObjectOutputStream.PutField
- Java.io - ObjectStreamClass
- Java.io - ObjectStreamField
- Java.io - OutputStream
- Java.io - OutputStreamWriter
- Java.io - PipedInputStream
- Java.io - PipedOutputStream
- Java.io - PipedReader
- Java.io - PipedWriter
- Java.io - PrintStream
- Java.io - PrintWriter
- Java.io - PushbackInputStream
- Java.io - PushbackReader
- Java.io - RandomAccessFile
- Java.io - Reader
- Java.io - SequenceInputStream
- Java.io - SerializablePermission
- Java.io - StreamTokenizer
- Java.io - StringBufferInputStream
- Java.io - StringReader
- Java.io - StringWriter
- Java.io - Writer
- Java.io package Useful Resources
- Java.io - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
85 Lectures 6 hours
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.
Following is the declaration for Java.io.PipedInputStream class −
public class PipedInputStream extends InputStream
Following are the fields for Java.io.PipedInputStream class −
protected byte buffer − This is the circular buffer into which incoming data is placed.
protected int in − This is the index of the position in the circular buffer at which the next byte of data will be stored when received from the connected piped output stream.
protected int out − This is the index of the position in the circular buffer at which the next byte of data will be read by this piped input stream.
protected static int PIPE_SIZE − This is the default size of the pipe's circular input buffer.
|Sr.No.||Constructor & Description|
This creates a PipedInputStream so that it is not yet connected.
This creates a PipedInputStream so that it is not yet connected and uses the specified pipe size for the pipe's buffer.
This creates a PipedInputStream so that it is connected to the piped output stream src.
PipedInputStream(PipedOutputStream src, int pipeSize)
This creates a PipedInputStream so that it is connected to the piped output stream src and uses the specified pipe size for the pipe's buffer.
|Sr.No.||Method & Description|
This method returns the number of bytes that can be read from this input stream without blocking.
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.
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.
This class inherits methods from the following classes −