Closed GoogleCodeExporter closed 9 years ago
Forgot to mention: the extra newline gets put to the end.
Original comment by hangcsa...@gmail.com
on 11 Jul 2013 at 9:41
I did further debug and if the file ends in a new line, .toString() keeps that
and doesn't put an extra.
Original comment by hangcsa...@gmail.com
on 11 Jul 2013 at 10:36
I can't reproduce this. I just created a file with no newline, read it with
Files.toString, and got a string with no newline. Also, take a look at the
tests in FilesTest, specifically testToString
(https://code.google.com/p/guava-libraries/source/browse/guava-tests/test/com/go
ogle/common/io/FilesTest.java#111). Among other things, it reads the file
ascii.txt
(https://code.google.com/p/guava-libraries/source/browse/guava-tests/test/com/go
ogle/common/io/testdata/ascii.txt) which has no newline and asserts that it's
equal to the constant String ASCII, which also has no newline.
Are you sure the file you're reading doesn't have a newline on the end? If it
doesn't, could you give me a simple test case to reproduce this?
Original comment by cgdecker@google.com
on 11 Jul 2013 at 2:52
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<issue id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:12
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:17
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:08
Original issue reported on code.google.com by
hangcsa...@gmail.com
on 11 Jul 2013 at 9:36