net.incongru.wiseio
Class ClosingIO<T extends java.io.Closeable>

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

public class ClosingIO<T extends java.io.Closeable>
extends java.lang.Object
implements IO<T>

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

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

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

Constructor Detail

ClosingIO

public ClosingIO(T flow,
                 IOOperation op)
Method Detail

withoutClose

public IO<T> withoutClose()

exec

public void exec()
          throws java.io.IOException
Specified by:
exec in interface IO<T extends java.io.Closeable>
Throws:
java.io.IOException

exec

protected void exec(T flow,
                    IOOperation op)
             throws java.io.IOException
Throws:
java.io.IOException

cleanupAndProcessException

protected java.io.IOException cleanupAndProcessException(java.io.IOException e,
                                                         T flow)
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.



Copyright © 2009. All Rights Reserved.