List of usage examples for java.util.stream Stream onClose
S onClose(Runnable closeHandler);
From source file:com.themodernway.server.core.io.IO.java
public static final Stream<String> lines(final Reader reader, final boolean greedy) throws IOException { final Stream<String> lines = IO.toBufferedReader(reader).lines(); if (greedy) { return CommonOps.toList(lines.onClose(IO.onClose(reader))).stream(); }/*from w ww . ja va 2 s .c o m*/ return lines; }