Class java.io.PipedInputStream
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.io.PipedInputStream

java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.PipedInputStream

public class PipedInputStream
extends InputStream
PipedInputStream must be connected to a PipedOutputStream to be useful. A thread reading from a PipedInputStream recieves data from a thread writing to the PipedOutputStream it is connected to.
See Also:
PipedOutputStream

Constructor Index

 o PipedInputStream(PipedOutputStream)
Creates an input file from the specified PiledOutputStream.
 o PipedInputStream()
Creates an input file that isn't connected to anything (yet).

Method Index

 o close()
Closes the input stream.
 o connect(PipedOutputStream)
Connects this input stream to a sender.
 o read()
Reads a byte of data.
 o read(byte[], int, int)
Reads into an array of bytes.

Constructors

 o PipedInputStream
  public PipedInputStream(PipedOutputStream src) throws IOException
Creates an input file from the specified PiledOutputStream.
Parameters:
src - the stream to connect to.
 o PipedInputStream
  public PipedInputStream()
Creates an input file that isn't connected to anything (yet). It must be connected to a PipedOutputStream before being used.

Methods

 o connect
  public void connect(PipedOutputStream src) throws IOException
Connects this input stream to a sender.
Parameters:
src - The OutputStream to connect to.
 o read
  public synchronized int read() throws IOException
Reads a byte of data. This method will block if no input is available.
Returns:
the byte read, or -1 if the end of the stream is reached.
Throws: IOException
If the pipe is broken.
Overrides:
read in class InputStream
 o read
  public synchronized int read(byte b[],
                               int off,
                               int len) throws IOException
Reads into an array of bytes. Blocks until some input is available.
Parameters:
b - the buffer into which the data is read
off - the start offset of the data
len - the maximum number of bytes read
Returns:
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Throws: IOException
If an I/O error has occurred.
Overrides:
read in class InputStream
 o close
  public void close() throws IOException
Closes the input stream. Must be called to release any resources associated with the stream.
Throws: IOException
If an I/O error has occurred.
Overrides:
close in class InputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index