Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.io

Class PipedOutputStream

java.lang.Object
|
+--java.io.OutputStream
   |
   +--java.io.PipedOutputStream


public class PipedOutputStream

extends OutputStream

This class writes its bytes to a PipedInputStream to which it is connected.

It is highly recommended that a PipedOutputStream and its connected PipedInputStream be in different threads. If they are in the same thread, read and write operations could deadlock the thread.

Author:

Constructor Summary

PipedOutputStream()

Create an unconnected PipedOutputStream.
PipedOutputStream(java.io.PipedInputStream sink)

Create a new PipedOutputStream instance to write to the specified PipedInputStream.

Method Summary

voidclose()

This method closes this stream so that no more data can be written to it.
voidconnect(java.io.PipedInputStream sink)

Connects this object to the specified PipedInputStream object.
voidflush()

This method does nothing.
voidwrite(int b)

Write a single byte of date to the stream.
voidwrite(byte[] b, int off, int len)

This method writes len bytes of data from the byte array buf starting at index offset in the array to the stream.

Constructor Details

PipedOutputStream

public PipedOutputStream()

Create an unconnected PipedOutputStream. It must be connected to a PipedInputStream using the connect method prior to writing any data or an exception will be thrown.


PipedOutputStream

public PipedOutputStream(java.io.PipedInputStream sink)

Create a new PipedOutputStream instance to write to the specified PipedInputStream. This stream is then ready for writing.

Parameters:

Throws:


Method Details

close

public void close()

This method closes this stream so that no more data can be written to it. Any further attempts to write to this stream may throw an exception

Throws:


connect

public void connect(java.io.PipedInputStream sink)

Connects this object to the specified PipedInputStream object. This stream will then be ready for writing.

Parameters:

Throws:


flush

public void flush()

This method does nothing.

Throws:


write

public void write(byte[] b, int off, int len)

This method writes len bytes of data from the byte array buf starting at index offset in the array to the stream. Note that this method will block if the PipedInputStream to which this object is connected has a buffer that cannot hold all of the bytes to be written.

Parameters:

Throws:


write

public void write(int b)

Write a single byte of date to the stream. Note that this method will block if the PipedInputStream to which this object is connected has a full buffer.

Parameters:

Throws: