|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.Writer
java.io.PipedWriter
public class PipedWriter
This class writes its chars to a PipedReader to
which it is connected.
It is highly recommended that a PipedWriter and its
connected PipedReader be in different threads. If
they are in the same thread, read and write operations could deadlock
the thread.
| Field Summary |
|---|
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
PipedWriter()
Create an unconnected PipedWriter. |
|
PipedWriter(PipedReader sink)
Create a new PipedWriter instance
to write to the specified PipedReader. |
|
| Method Summary | |
|---|---|
void |
close()
This method closes this stream so that no more data can be written to it. |
void |
connect(PipedReader sink)
Connects this object to the specified PipedReader
object. |
void |
flush()
This method does nothing. |
void |
write(char[] buffer,
int offset,
int len)
This method writes len chars of data from the char array
buf starting at index offset in the array
to the stream. |
void |
write(int b)
Write a single char of date to the stream. |
| Methods inherited from class java.io.Writer |
|---|
append, append, append, write, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PipedWriter()
PipedReader using the connect
method prior to writing any data or an exception will be thrown.
public PipedWriter(PipedReader sink)
throws IOException
PipedWriter instance
to write to the specified PipedReader. This stream
is then ready for writing.
sink - The PipedReader to connect this stream to.
IOException - If sink has already been connected
to a different PipedWriter.| Method Detail |
|---|
public void connect(PipedReader sink)
throws IOException
PipedReader
object. This stream will then be ready for writing.
sink - The PipedReader to connect this stream to
IOException - If the stream has not been connected or has
been closed.
public void write(int b)
throws IOException
PipedReader to which this object is
connected has a full buffer.
write in class Writerb - The char of data to be written, passed as an int.
IOException - If the stream has not been connected or has
been closed.
public void write(char[] buffer,
int offset,
int len)
throws IOException
len chars of data from the char array
buf starting at index offset in the array
to the stream. Note that this method will block if the
PipedReader to which this object is connected has
a buffer that cannot hold all of the chars to be written.
write in class Writerbuffer - The array containing chars to write to the stream.offset - The index into the array to start writing chars from.len - The number of chars 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 WriterIOException - If the stream is closed.
public void close()
throws IOException
close in interface Closeableclose in class WriterIOException - If an error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||