On 1/4/15 12:25 PM, Alan Bateman wrote:
On 04/01/2015 19:18, Xueming Shen wrote:
:
I agree with Alan that the general interface "Appendable" probably
should not get
into the specific "formatting" functionality here. And I also think
the "line.separator"
should not be in the "Writer" as well, writer/reader does not deal
with "formatting",
only couple "special" writers need to work with "line"
I've often wondered about BufferedReader/BufferedWriter supporting
lines, it often feels like the readLine and newLine methods should
have been further up in the hierarchy in Reader and Writer so the
BufferedXXX types just adds buffering. I realize of course that
newLine might be very inefficient without buffering. Do have all the
history? I'm wondering if there is merit looking at this again as it
could be useful beyond the case that Claes wants to address. If Writer
did define newLine then then the proposed lineSeperator wouldn't be
needed.
-Alan
I don't have the history. My take on this is that the read/newLine()
methods in BufferedReader/Writer
are more a pair of utility/convenient/bonus method. They serve parsing
and formatting functionality,
which probably should belong to the Scanner and Formatter, rather than
the io reader and writer. Of
course we didn't have scanner and formatter in earlier days:-) And it's
convenient to have them in
the buffered reader/writer, if the line is only thing you care about on
top of "character". When I care
about a little more than a "line", I started to use Scanner more often
these days.
-Sherman