/* **************************************************************************

  $Archive: /njcl_v2/src/com/novell/service/session/util/MultiplexPrintWriter.java $
  $Revision: 1 $
  $Modtime: 4/10/00 1:48p $

  Copyright (c) 1997 Novell, Inc.  All Rights Reserved.

  THIS WORK IS  SUBJECT  TO  U.S.  AND  INTERNATIONAL  COPYRIGHT  LAWS  AND
  TREATIES.   NO  PART  OF  THIS  WORK MAY BE  USED,  PRACTICED,  PERFORMED
  COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED,  ABRIDGED, CONDENSED,
  EXPANDED,  COLLECTED,  COMPILED,  LINKED,  RECAST, TRANSFORMED OR ADAPTED
  WITHOUT THE PRIOR WRITTEN CONSENT OF NOVELL, INC. ANY USE OR EXPLOITATION
  OF THIS WORK WITHOUT AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO
  CRIMINAL AND CIVIL LIABILITY.

****************************************************************************/
package com.novell.service.session.util;

import java.util.*;
import java.io.*;

class MultiplexPrintWriter extends PrintWriter
{
   Vector outputs;

   MultiplexPrintWriter(Writer ignore)
   {
      super(ignore);
      outputs = new Vector();
   }

   public void addElement(Object object)
   {
      throw new ClassCastException("Only PrintWriter type accepted");
   }

   public void addElement(PrintWriter object)
   {
      outputs.addElement(object);
   }

   public void println(String msg)
   {
      Enumeration enum = outputs.elements();
      while (enum.hasMoreElements())
      {
         PrintWriter pw = (PrintWriter)enum.nextElement();
         pw.println(msg);
      }
   }
}                                           
