net.incongru.wiseio
Class Output<T extends java.io.Closeable & java.io.Flushable>

java.lang.Object
  extended by net.incongru.wiseio.ClosingIO<T>
      extended by net.incongru.wiseio.Output<T>
All Implemented Interfaces:
IO<T>

public class Output<T extends java.io.Closeable & java.io.Flushable>
extends ClosingIO<T>

Executes an operation, flushes the stream as required, closes the stream, wraps exceptions as needed.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Constructor Summary
Output(T flow, IOOperation op)
           
 
Method Summary
protected  java.io.IOException cleanupAndProcessException(java.io.IOException e, T flow)
          Do your business here.
protected  void exec(T flow, IOOperation op)
           
 Output<T> withFlush()
           
 Output<T> withFlushWhenSuccessful()
           
 
Methods inherited from class net.incongru.wiseio.ClosingIO
exec, withoutClose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Output

public Output(T flow,
              IOOperation op)
Method Detail

withFlush

public Output<T> withFlush()

withFlushWhenSuccessful

public Output<T> withFlushWhenSuccessful()

exec

protected void exec(T flow,
                    IOOperation op)
             throws java.io.IOException
Overrides:
exec in class ClosingIO<T extends java.io.Closeable & java.io.Flushable>
Throws:
java.io.IOException

cleanupAndProcessException

protected java.io.IOException cleanupAndProcessException(java.io.IOException e,
                                                         T flow)
Description copied from class: ClosingIO
Do your business here. Since the flow is created outside the scope of the ClosingIO instance, you have access to it, we don't need to pass it around.

Overrides:
cleanupAndProcessException in class ClosingIO<T extends java.io.Closeable & java.io.Flushable>


Copyright © 2009. All Rights Reserved.