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)

Constructor Index

 o SplitWriter()
Create an empty SplitWriter.
 o SplitWriter(Writer)
Create SplitWriter on the given Writer

Method Index

 o add(OutputStream)
Add an outputStream to the end of the SplitWriter.
 o add(Writer)
Add a writer to the end of the SplitWriter.
 o close()
Close the stream, flushing it first.
 o flush()
Flush the stream.
 o remove(Writer)
Removes a writer from the SplitWriter.
 o write(char[], int, int)
Write a portion of an array of characters.

Constructors

 o SplitWriter
 public SplitWriter(Writer output)
Create SplitWriter on the given Writer

 o SplitWriter
 public SplitWriter()
Create an empty SplitWriter. Any output on an empty SplitWriter is ignored.

Methods

 o add
 public void add(Writer output)
Add a writer to the end of the SplitWriter.

 o add
 public void add(OutputStream output)
Add an outputStream to the end of the SplitWriter.

 o remove
 public void remove(Writer output)
Removes a writer from the SplitWriter.

 o 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
 o 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
 o 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