thinkmap.server
Class SplitterOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by thinkmap.server.SplitterOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class SplitterOutputStream
extends OutputStream

SplitterOutputStream is a single OutputStream which passes its output on to (up to) two other OutputStream objects. For example: FileOutputStream fos1 = new FileOutputStream(new File("foo.txt")); FileOutputStream fos2 = new FileOutputStream(new File("bar.txt")); SplitterOutputStream sos = new SplitterOutputStream(fos1, fos2); The above code will result in one output stream, sos, which, when written to, will cause the data written to be funnelled to both the fos1 and fos2 FileOutputStream objects. If null is passed in for the first or second output stream (or both), nothing will be written to that stream. This is simply to make code simpler and cleaner,

Version:
$Revision: 1.1 $

Constructor Summary
SplitterOutputStream(OutputStream os1, OutputStream os2)
           
 
Method Summary
 void close()
           
 void flush()
           
 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

SplitterOutputStream

public SplitterOutputStream(OutputStream os1,
                            OutputStream os2)
Method Detail

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.