com.sun.jini.mercury
Class EventWriter.SwitchOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.sun.jini.mercury.EventWriter.SwitchOutputStream
All Implemented Interfaces:
Closeable, Flushable
Enclosing class:
EventWriter

private static class EventWriter.SwitchOutputStream
extends OutputStream

This class is intended to be the OutputStream provided to EventOutputStream's constructor. This class essentially delegates OutputStream functionality to the provided LogOutputStream. The setOutputStream method allows the underlying LogOutputStream to be re-targeted at runtime.


Field Summary
private  LogOutputStream out
          The delegation target for the OutputStream methods
 
Constructor Summary
EventWriter.SwitchOutputStream(LogOutputStream out)
          Simple constructor that assigns the given argument to the appropriate internal field.
 
Method Summary
 void close()
           
 void flush()
           
 void setOutputStream(LogOutputStream out)
          Sets the delegation target
 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
 

Field Detail

out

private LogOutputStream out
The delegation target for the OutputStream methods

Constructor Detail

EventWriter.SwitchOutputStream

public EventWriter.SwitchOutputStream(LogOutputStream out)
Simple constructor that assigns the given argument to the appropriate internal field.

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

setOutputStream

public void setOutputStream(LogOutputStream out)
Sets the delegation target



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.