Reputation: 4266
I want to convert an InputStream is
into a Stream<String> stream
given a Charset cs
in such a way that stream
consists of the lines of is
. Furthermore a line of is
should not be read immediately but only in case stream
needs it.
Upvotes: 39
Views: 22407
Reputation: 38195
I think you can try:
Stream<String> lines = new BufferedReader(new InputStreamReader(is, cs)).lines();
Upvotes: 67