public static void closeEL ( Object obj ) { if ( obj instanceof InputStream ) IOUtil . closeEL ( ( InputStream ) obj ) ; else if ( obj instanceof OutputStream ) IOUtil . closeEL ( ( OutputStream ) obj ) ; else if ( obj instanceof Writer ) IOUtil . closeEL ( ( Writer ) obj ) ; else if ( obj instanceof Reader ) IOUtil . closeEL ( ( Reader ) obj ) ; else if ( obj instanceof Closeable ) IOUtil . closeEL ( ( Closeable ) obj ) ; else if ( obj instanceof ZipFile ) IOUtil . closeEL ( ( ZipFile ) obj ) ; else if ( obj instanceof ResultSet ) IOUtil . closeEL ( ( ResultSet ) obj ) ; else if ( obj instanceof Connection ) IOUtil . closeEL ( ( Connection ) obj ) ; else { try { Method method = obj . getClass ( ) . getMethod ( "close" , new Class [ 0 ] ) ; method . invoke ( obj , new Object [ 0 ] ) ; } catch ( Throwable e ) { ExceptionUtil . rethrowIfNecessary ( e ) ; } } }
call close method from any Object with a close method .