All Packages Class Hierarchy This Package Previous Next Index
Class sdsu.io.SplitWriter
java.lang.Object
|
+----java.io.Writer
|
+----sdsu.io.SplitWriter
- public class SplitWriter
- extends Writer
This class acts like an N way split in a writer stream.
N different writers can be connected to the end of
a SplitWriter. These N writers are not chained together.
What ever is writen on the SplitWriter is copied and written
to each of the N writers. The following shows a SplitWriter
with three writers.
|-->----
---->---|-->----
|-->----
- Version:
- 1.0 30 December 1997
- Author:
- Roger Whitney
(whitney@cs.sdsu.edu)
-
SplitWriter()
- Create an empty SplitWriter.
-
SplitWriter(Writer)
- Create SplitWriter on the given Writer
-
add(OutputStream)
- Add an outputStream to the end of the SplitWriter.
-
add(Writer)
- Add a writer to the end of the SplitWriter.
-
close()
- Close the stream, flushing it first.
-
flush()
- Flush the stream.
-
remove(Writer)
- Removes a writer from the SplitWriter.
-
write(char[], int, int)
- Write a portion of an array of characters.
SplitWriter
public SplitWriter(Writer output)
- Create SplitWriter on the given Writer
SplitWriter
public SplitWriter()
- Create an empty SplitWriter. Any output on an empty
SplitWriter is ignored.
add
public void add(Writer output)
- Add a writer to the end of the SplitWriter.
add
public void add(OutputStream output)
- Add an outputStream to the end of the SplitWriter.
remove
public void remove(Writer output)
- Removes a writer from the SplitWriter.
flush
public void flush() throws IOException
- Flush the stream. If the stream has saved any characters from the
various write() methods in a buffer, write them immediately to their
intended destination. Then, if that destination is another character or
byte stream, flush it. Thus one flush() invocation will flush all the
buffers in a chain of Writers and OutputStreams.
- Throws: IOException
- If an I/O error occurs
- Overrides:
- flush in class Writer
close
public void close() throws IOException
- Close the stream, flushing it first. Once a stream has been closed,
further write() or flush() invocations will cause an IOException to be
thrown. Closing a previously-closed stream, however, has no effect.
- Throws: IOException
- If an I/O error occurs
- Overrides:
- close in class Writer
write
public void write(char charBuffer[],
int offset,
int length) throws IOException
- Write a portion of an array of characters.
- Parameters:
- charBuffer - Array of characters
- offset - Offset from which to start writing characters
- length - Number of characters to write
- Throws: IOException
- If an I/O error occurs
- Overrides:
- write in class Writer
All Packages Class Hierarchy This Package Previous Next Index