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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I think you can try:
Stream<String> lines = new BufferedReader(new InputStreamReader(is, cs)).lines();