public void invokeHandler ( OutputStream outputStream ) throws IOException { @ SuppressWarnings ( "unchecked" ) T t = OutputStream . class . equals ( this . streamClass ) ? ( T ) outputStream : Classes . newInstance ( streamClass , outputStream ) ; handle ( t ) ; t . flush ( ) ; t . close ( ) ; }
Helper method used to invoke concrete output stream handler method . Please note that given output stream is closed after handler invocation just before this method return .