edu.udo.cs.miningmart.m4.utils
Class MultipleOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byedu.udo.cs.miningmart.m4.utils.MultipleOutputStream

public class MultipleOutputStream
extends java.io.OutputStream

A MultipleOutputStream holds several OutputStreams. Each method called by this OutputStream is forwarded to the set of OutputStreams. So you can write something to System.out and to a file.

Version:
$Id: MultipleOutputStream.java,v 1.3 2006/04/11 14:10:10 euler Exp $
Author:
Daniel Hakenjos

Constructor Summary
MultipleOutputStream()
          Inits this MultipleOutputStream containing no OutputStream.
MultipleOutputStream(java.util.Collection outputStreams)
          Inits this MultipleOutputStream with the specified Collection of OutputStreams.
MultipleOutputStream(java.io.OutputStream stream)
          Inits this MultipleOutputStream only containing th specified OutputStream.
 
Method Summary
 void addOutputStream(java.io.OutputStream stream)
          Adds the OutputStream.
 void close()
           
 boolean containsOutputStream(java.io.OutputStream stream)
          Checks wether the OutputStream is available or not.
 void flush()
           
 int getNumberOfOutputStreams()
          Gets the number of OutputStreams.
 java.io.OutputStream getOutputStream(int index)
          Gets the OutputStream by its index.
 boolean removeOutputStream(java.io.OutputStream stream)
          Removes the OutputStream.
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipleOutputStream

public MultipleOutputStream()
Inits this MultipleOutputStream containing no OutputStream.


MultipleOutputStream

public MultipleOutputStream(java.io.OutputStream stream)
Inits this MultipleOutputStream only containing th specified OutputStream.


MultipleOutputStream

public MultipleOutputStream(java.util.Collection outputStreams)
Inits this MultipleOutputStream with the specified Collection of OutputStreams.

Method Detail

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException
See Also:
OutputStream.close()

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException
See Also:
OutputStream.flush()

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Throws:
java.io.IOException
See Also:
OutputStream.write(byte[], int, int)

write

public void write(byte[] b)
           throws java.io.IOException
Throws:
java.io.IOException
See Also:
OutputStream.write(byte[])

write

public void write(int b)
           throws java.io.IOException
Throws:
java.io.IOException
See Also:
OutputStream.write(int)

getNumberOfOutputStreams

public int getNumberOfOutputStreams()
Gets the number of OutputStreams.


getOutputStream

public java.io.OutputStream getOutputStream(int index)
Gets the OutputStream by its index.

Returns:
null if the index is wrong

addOutputStream

public void addOutputStream(java.io.OutputStream stream)
Adds the OutputStream.


removeOutputStream

public boolean removeOutputStream(java.io.OutputStream stream)
Removes the OutputStream.


containsOutputStream

public boolean containsOutputStream(java.io.OutputStream stream)
Checks wether the OutputStream is available or not.



Copyright © 2001-2005