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
-
PipedInputStream()
- Creates an input file that isn't connected to anything (yet).
-
PipedInputStream(PipedOutputStream)
- Creates an input file from the specified PiledOutputStream.
-
available()
- Returns the number of bytes that can be read
without blocking.
-
close()
- Closes the input stream.
-
connect(PipedOutputStream)
- Connects this input stream to a sender.
-
read()
- Reads a byte of data.
-
read(byte[], int, int)
- Reads into an array of bytes.
PipedInputStream
public PipedInputStream(PipedOutputStream src) throws IOException
- Creates an input file from the specified PiledOutputStream.
- Parameters:
- src - the stream to connect to.
PipedInputStream
public PipedInputStream()
- Creates an input file that isn't connected to anything (yet).
It must be connected to a PipedOutputStream before being used.
connect
public void connect(PipedOutputStream src) throws IOException
- Connects this input stream to a sender.
- Parameters:
- src - The OutputStream to connect to.
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
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
available
public synchronized int available() throws IOException
- Returns the number of bytes that can be read
without blocking.
- Overrides:
- available in class InputStream
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