org.apache.clerezza.triaxrs.util
Class FirstByteActionOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.clerezza.triaxrs.util.FirstByteActionOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class FirstByteActionOutputStream
extends OutputStream

An outputstream that executes an action when the firts character is writter, if no chracter is written the actin is executed when closing the stream

Author:
reto

Constructor Summary
FirstByteActionOutputStream(OutputStream base, Runnable action)
           
 
Method Summary
 void close()
           
 void flush()
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FirstByteActionOutputStream

public FirstByteActionOutputStream(OutputStream base,
                                   Runnable action)
Method Detail

write

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

close

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

flush

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


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.