Write Stream<String> to a file?

Sam Pullara spullara at gmail.com
Tue Nov 19 15:35:13 PST 2013


Hmmm. Maybe something like:

    Charset cs = Charset.forName("UTF-8");
    Stream<String> oldfile = Files.lines(Paths.get(args[0]), cs);
    Files.write(Paths.get(args[1]), oldfile::iterator, cs);

Sam

On Nov 19, 2013, at 3:19 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:

> We have convenience methods to read lines from a file:
>    Stream<String> Files.lines()
> 
> What's Java's idiomatic way to write a Stream<String> to a file?
> 
> Zhong Yu
> 



More information about the lambda-dev mailing list