bootiful-sqltemplate-core/src/main/java/ninja/cero/sqltemplate/core/SqlTemplate.java
public <T, U> U forStream(
            String fileName,
            Class<T> clazz,
            Function<? super Stream<T>, U> handleStream) {
        String sql = getTemplate(fileName, EMPTY_ARGS);
        PreparedStatementSetter pss = paramBuilder.byArgs(new Object[0]);
        RowMapper<T> mapper = mapperBuilder.mapper(clazz);
        return queryStreamWithOrdinalParams(sql, pss, mapper, handleStream);
    }
public <T, U> U forStream(
            String fileName,
            Class<T> clazz,
            Function<? super Stream<T>, U> handleStream) {
        String sql = getTemplate(fileName, EMPTY_ARGS);
        PreparedStatementSetter pss = paramBuilder.byArgs(new Object[0]);
        RowMapper<T> mapper = mapperBuilder.mapper(clazz);
        return queryStreamWithOrdinalParams(sql, pss, mapper, handleStream);
    }
Executes a query, passing the row objects to {@code handleStream} as a stream.

<p>Example usage:</p>

<pre>
int totalSalary = sqlTemplate.forStream("/path/to/query.sql", Emp.class,
(Stream&lt;Emp&gt; empStream) -&gt; empStream.mapToInt(Emp::getSalary).sum());
</pre>

@param fileName SQL specifier
@param clazz the row object class
@param handleStream  the function which is applied to the stream
@param <T> the row object type
@param <U> the result type
@return the result of {@code handleStream}
@throws org.springframework.dao.DataAccessException if there is any problem