|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
java.io.PipedOutputStream
public class PipedOutputStream
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.
| Constructor Summary | |
|---|---|
PipedOutputStream()
Create an unconnected PipedOutputStream. |
|
PipedOutputStream(PipedInputStream sink)
Create a new PipedOutputStream instance
to write to the specified PipedInputStream. |
|
| Method Summary | |
|---|---|
void |
close()
This method closes this stream so that no more data can be written to it. |
void |
connect(PipedInputStream sink)
Connects this object to the specified PipedInputStream
object. |
void |
flush()
This method does nothing. |
void |
write(byte[] buffer,
int offset,
int len)
This method writes len bytes of data from the byte array
buf starting at index offset in the array
to the stream. |
void |
write(int b)
Write a single byte of date to the stream. |
| Methods inherited from class java.io.OutputStream |
|---|
write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PipedOutputStream()
PipedInputStream using the connect
method prior to writing any data or an exception will be thrown.
public PipedOutputStream(PipedInputStream sink)
throws IOException
PipedOutputStream instance
to write to the specified PipedInputStream. This stream
is then ready for writing.
sink - The PipedInputStream to connect this stream to.
IOException - If sink has already been connected
to a different PipedOutputStream.| Method Detail |
|---|
public void connect(PipedInputStream sink)
throws IOException
PipedInputStream
object. This stream will then be ready for writing.
sink - The PipedInputStream to connect this stream to
IOException - If the stream has not been connected or has
been closed.
public void write(int b)
throws IOException
PipedInputStream to which this object is
connected has a full buffer.
write in class OutputStreamb - The byte of data to be written, passed as an int.
IOException - If the stream has not been connected or has
been closed.
public void write(byte[] buffer,
int offset,
int len)
throws IOException
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.
write in class OutputStreambuffer - The array containing bytes to write to the stream.offset - The index into the array to start writing bytes from.len - The number of bytes to write.
IOException - If the stream has not been connected or has
been closed.
public void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOException - If the stream is closed.
public void close()
throws IOException
close in interface Closeableclose in class OutputStreamIOException - If an error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||