Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-06 Thread Markus KARG
On Sun, 4 May 2025 05:08:46 GMT, Alan Bateman wrote: >> Oh, and we should set `next` afterwards, so the `Reader` knows that the end >> of the sequence is reached: >> >> >> public String readAllChars() throws IOException { >> ensureOpen(); >> var len = cs.length(); >> var remainder

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v16]

2025-05-06 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Revert BufferedReader; simplify Reader changes removing overridable self-call; update test - Changes

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-05 Thread Brian Burkhalter
On Fri, 2 May 2025 19:38:11 GMT, Rémi Forax wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Fix readAllChars gaffe in Reader returned by Readed.of and >> account for it in test > > test/jdk/java/io/Bu

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v15]

2025-05-05 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Fix potential NPE in test - Changes: - all: https://git.openjdk.org/jdk/pull/24728/files - new: h

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-05 Thread Brian Burkhalter
On Thu, 1 May 2025 18:00:54 GMT, Stuart Marks wrote: > I'd suggest not having this method's implementation depend on an overridable > method. I'm jumping the gun here by referring to an implementation detail, but the overridable method problem could be circumvented using an approach taken in

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-05 Thread Brian Burkhalter
On Fri, 2 May 2025 19:00:42 GMT, Stuart Marks wrote: > I think it's still ambiguous. [...] Without addressing the specific comments, I would simply like to point out that "as if" and "equivalent" is common phrasing in this area, e.g., - [File.toPath](https://docs.oracle.com/en/java/javase/24/

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-03 Thread Alan Bateman
On Sat, 3 May 2025 09:30:17 GMT, Markus KARG wrote: >> src/java.base/share/classes/java/io/Reader.java line 213: >> >>> 211: public String readAllChars() throws IOException { >>> 212: ensureOpen(); >>> 213: return cs.toString().substring(next); >> >>

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-03 Thread Markus KARG
On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Fix readAllChars gaffe in Reader returned by

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-03 Thread Markus KARG
On Sat, 3 May 2025 07:25:09 GMT, Markus KARG wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Fix readAllChars gaffe in Reader returned by Readed.of and >> account for it in test > > src/java.base/shar

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-03 Thread Markus KARG
On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Fix readAllChars gaffe in Reader returned by

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-03 Thread Markus KARG
On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Fix readAllChars gaffe in Reader returned by

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-02 Thread Stuart Marks
On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Fix readAllChars gaffe in Reader returned by

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-02 Thread Rémi Forax
On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Fix readAllChars gaffe in Reader returned by

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-02 Thread Archie Cobbs
On Fri, May 2, 2025 at 2:04 PM Stuart Marks wrote: > There was a back-and-forth a while ago -- I think @bplb was involved -- > where there was similar wording about something being "equivalent to" or > "as if" foo() was called, and the person was insistent that this meant that > foo() should actu

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-02 Thread Stuart Marks
On Thu, 1 May 2025 19:19:32 GMT, Roger Riggs wrote: >> src/java.base/share/classes/java/io/Reader.java line 408: >> >>> 406: * This method works as if invoking it were equivalent to >>> evaluating >>> 407: * the expression: >>> 408: * {@linkplain >>> #readAllChars()}.lines().to

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-01 Thread Roger Riggs
On Thu, 1 May 2025 17:51:53 GMT, Stuart Marks wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Fix readAllChars gaffe in Reader returned by Readed.of and >> account for it in test > > src/java.base/sha

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v11]

2025-05-01 Thread Roger Riggs
On Tue, 22 Apr 2025 16:51:05 GMT, Alan Bateman wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Add Reader.readAllLines; test not yet updated > > src/java.base/share/classes/java/io/Reader.java line 403

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-01 Thread Stuart Marks
On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Fix readAllChars gaffe in Reader returned by

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-01 Thread Stuart Marks
On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Fix readAllChars gaffe in Reader returned by

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-01 Thread Stuart Marks
On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Fix readAllChars gaffe in Reader returned by

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v13]

2025-04-23 Thread Brian Burkhalter
On Wed, 23 Apr 2025 18:06:27 GMT, Johannes Graham wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Improve test per reviewer comments > > src/java.base/share/classes/java/io/Reader.java line 212: > >>

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-04-23 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Fix readAllChars gaffe in Reader returned by Readed.of and account for it in test - Changes: - all

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v13]

2025-04-23 Thread Brian Burkhalter
On Wed, 23 Apr 2025 18:06:27 GMT, Johannes Graham wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Improve test per reviewer comments > > src/java.base/share/classes/java/io/Reader.java line 212: > >>

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v13]

2025-04-23 Thread Johannes Graham
On Wed, 23 Apr 2025 16:52:29 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Improve test per reviewer comments src/java.

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v12]

2025-04-23 Thread Brian Burkhalter
On Wed, 23 Apr 2025 16:06:54 GMT, Johannes Döbler wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Add missing toList(), tweak verbiage; update test > > test/jdk/java/io/BufferedReader/ReadAll.java line

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v13]

2025-04-23 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Improve test per reviewer comments - Changes: - all: https://git.openjdk.org/jdk/pull/24728/files

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v12]

2025-04-23 Thread Brian Burkhalter
On Wed, 23 Apr 2025 15:58:41 GMT, Johannes Döbler wrote: >>> The test will fail if the default Charset is not UTF-8 >> >> When does that happen (cf. [JEP 400)](https://openjdk.org/jeps/400)? > > The default charset is not UTF-8 when you specify JVM param -Dfile.encoding, > which of course is un

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v12]

2025-04-23 Thread Johannes Döbler
On Tue, 22 Apr 2025 17:12:52 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Add missing toList(), tweak verbiage; update

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v12]

2025-04-23 Thread Johannes Döbler
On Wed, 23 Apr 2025 15:39:35 GMT, Brian Burkhalter wrote: >> test/jdk/java/io/BufferedReader/ReadAll.java line 83: >> >>> 81: int toIndex = rnd.nextInt(fromIndex, plen); >>> 82: String str = PHRASE.substring(fromIndex, toIndex); >>> 83: byte[] strB

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v12]

2025-04-23 Thread Brian Burkhalter
On Wed, 23 Apr 2025 14:58:16 GMT, Johannes Döbler wrote: > The test will fail if the default Charset is not UTF-8 When does that happen (cf. [JEP 400)](https://openjdk.org/jeps/400)? - PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2056340354

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v12]

2025-04-23 Thread Johannes Döbler
On Tue, 22 Apr 2025 17:12:52 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Add missing toList(), tweak verbiage; update

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v12]

2025-04-23 Thread Brian Burkhalter
On Tue, 22 Apr 2025 17:12:52 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Add missing toList(), tweak verbiage; update

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v12]

2025-04-22 Thread Brian Burkhalter
On Tue, 22 Apr 2025 17:12:52 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Add missing toList(), tweak verbiage; update

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v11]

2025-04-22 Thread Brian Burkhalter
On Tue, 22 Apr 2025 16:53:30 GMT, Brian Burkhalter wrote: >> src/java.base/share/classes/java/io/Reader.java line 426: >> >>> 424: */ >>> 425: public List readAllLines() throws IOException { >>> 426: return readAllChars().lines(); >> >> I assume you are missing toList() here. >

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v12]

2025-04-22 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Add missing toList(), tweak verbiage; update test - Changes: - all: https://git.openjdk.org/jdk/pul

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v11]

2025-04-22 Thread Brian Burkhalter
On Tue, 22 Apr 2025 16:48:43 GMT, Alan Bateman wrote: > I assume you are missing toList() here. Yes, that was stupid. The `make jdk` caught it but I somehow missed the error message. - PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2054494622

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v11]

2025-04-22 Thread Alan Bateman
On Tue, 22 Apr 2025 16:32:09 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Add Reader.readAllLines; test not yet updated

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v11]

2025-04-22 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Add Reader.readAllLines; test not yet updated - Changes: - all: https://git.openjdk.org/jdk/pull/24

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v8]

2025-04-22 Thread Brian Burkhalter
On Tue, 22 Apr 2025 15:34:43 GMT, Brian Burkhalter wrote: >> src/java.base/share/classes/java/io/Reader.java line 401: >> >>> 399: * Reads all remaining characters into a string. >>> 400: * >>> 401: * This method reads all content including the line separators >>> in >> >> Agai

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v10]

2025-04-22 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Add some more dangling "remaining"s - Changes: - all: https://git.openjdk.org/jdk/pull/24728/files

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v8]

2025-04-22 Thread Brian Burkhalter
On Tue, 22 Apr 2025 10:16:48 GMT, Alan Bateman wrote: > Again, just to say that it's all remaining rather than "all content" as some > characters may have been consumed before this method is invoked. Thanks, that was inadvertently overlooked. See 42e6f3b. > Now that you have readAllChars, I th

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v9]

2025-04-22 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Add overlooked "remaining"s to Reader.readAllChars - Changes: - all: https://git.openjdk.org/jdk/pu

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v8]

2025-04-22 Thread Alan Bateman
On Mon, 21 Apr 2025 20:47:38 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Change "lines" to "characters" in spec of Rea

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v8]

2025-04-21 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Change "lines" to "characters" in spec of Reader.readAllChars, where appropriate - Changes: - all:

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-21 Thread Brian Burkhalter
On Fri, 18 Apr 2025 15:10:02 GMT, Chen Liang wrote: >> Maybe it can be implemented by referring to `InputStream::readNBytes(int)` >> (The default implementation of `InputStream::readAllBytes()` is based on it): >> >> https://github.com/openjdk/jdk/blob/22e8a97a1ce4e1c781fbc6f1e271c477fe95f069/s

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v6]

2025-04-21 Thread Brian Burkhalter
On Mon, 21 Apr 2025 08:17:30 GMT, Andrey Turbanov wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Remove unused import > > test/jdk/java/io/BufferedReader/ReadAll.java line 70: > >> 68: int si

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v7]

2025-04-21 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: readString -> readAllChars; update test - Changes: - all: https://git.openjdk.org/jdk/pull/24728/fi

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v6]

2025-04-21 Thread Andrey Turbanov
On Fri, 18 Apr 2025 20:10:32 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Remove unused import test/jdk/java/io/Buffer

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Brian Burkhalter
On Fri, 18 Apr 2025 19:11:15 GMT, Roger Riggs wrote: > Without over-rotating on performance concerns, [...] Or just for the sake of silliness: public List readAllLines() throws IOException { String regex = "(?:\n)|(?:\r)|\r(?=\n)"; return Arrays.asList(readString().split(reg

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v6]

2025-04-18 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Remove unused import - Changes: - all: https://git.openjdk.org/jdk/pull/24728/files - new: https:

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Brian Burkhalter
On Fri, 18 Apr 2025 19:02:26 GMT, Alan Bateman wrote: > I don't think a readLine would make sense for Reader If there were a `readLine` I would expect it not to be exposed in the API. - PR Comment: https://git.openjdk.org/jdk/pull/24728#issuecomment-2816085214

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Roger Riggs
On Thu, 17 Apr 2025 23:07:35 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with two > additional commits since the last revision: > > - 8354724: Increment copyright year in Reader > - 835

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Alan Bateman
On Fri, 18 Apr 2025 17:35:00 GMT, Stuart Marks wrote: > Line-oriented methods on Reader instead of BufferedReader. I don't think a readLine would make sense for Reader but I think we can explore a method that reads all remaining characters (to EOS) as a sequence of lines. So a very different i

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Brian Burkhalter
On Fri, 18 Apr 2025 17:35:00 GMT, Stuart Marks wrote: > There's logic in readLine() that terminates the current line if a CR is > encountered, and it _also_ sets a `skipLF` flag which skips the LF if it's > the very next character. I will also point out here that, based on a somewhat cursory s

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Stuart Marks
On Thu, 17 Apr 2025 23:07:35 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with two > additional commits since the last revision: > > - 8354724: Increment copyright year in Reader > - 835

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v3]

2025-04-18 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Modify specification verbiage more or less as suggested - Changes: - all: https://git.openjdk.org/j

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Alan Bateman
On Fri, 18 Apr 2025 15:47:07 GMT, Brian Burkhalter wrote: > So you are suggesting moving `readAllLines` up from `BufferedReader` to > `Reader`? I think add it to the list to explore as a non-buffered Reader could support it, esp. when it doesn't support a mark. There are advantages and disadva

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Brian Burkhalter
On Thu, 17 Apr 2025 23:07:35 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with two > additional commits since the last revision: > > - 8354724: Increment copyright year in Reader > - 835

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Brian Burkhalter
On Fri, 18 Apr 2025 14:46:08 GMT, Alan Bateman wrote: > I don't think it would be too bad to have Reader define a method to read the > remaining characters as a sequence of lines. So you are suggesting moving `readAllLines` up from `BufferedReader` to `Reader`? - PR Comment: http

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Chen Liang
On Fri, 18 Apr 2025 15:02:56 GMT, Glavo wrote: >> public static String readString() throws IOException { >> char[] chars = new char[TRANSFER_BUFFER_SIZE]; >> int n; >> int off = 0; >> int rest = chars.length; >> while ((n = read(chars, off, rest)) != -1) {

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Glavo
On Fri, 18 Apr 2025 06:59:18 GMT, Shaojin Wen wrote: >> Seems you want to make the `result` StringBuilder fully expanded >> (maybeLatin1 = true, coder = UTF16) initially, so we just compress the whole >> builder with a vectorized intrinsic instead of char-by-char loop in >> `append`. Makes sen

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Alan Bateman
On Thu, 17 Apr 2025 23:07:35 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with two > additional commits since the last revision: > > - 8354724: Increment copyright year in Reader > - 835

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Shaojin Wen
On Thu, 17 Apr 2025 23:07:35 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with two > additional commits since the last revision: > > - 8354724: Increment copyright year in Reader > - 835

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v4]

2025-04-18 Thread Brian Burkhalter
On Thu, 17 Apr 2025 22:43:59 GMT, Roger Riggs wrote: > I'm fine with moving `readString` to `Reader`. Given that [Reader.read(char[])](https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/io/Reader.html#read(char[])) exists, this should be a trivial change, implementation-wise. -

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-18 Thread Shaojin Wen
On Fri, 18 Apr 2025 02:49:43 GMT, Chen Liang wrote: >> `Reader` by specification works on `char`, so I think this is fine. Even if >> a StringBuilder is UTF16, it still has to check for all-Latin1 characters at >> the time of string creation, so not really an overhead elimination. > > Seems you

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-17 Thread Chen Liang
On Fri, 18 Apr 2025 02:32:39 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/java/io/Reader.java line 424: >> >>> 422: int n; >>> 423: while ((n = read(str)) != -1) { >>> 424: result.append(str, 0, n); >> >> If the characters in the Reader are always Latin1, t

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-17 Thread Shaojin Wen
On Fri, 18 Apr 2025 02:26:10 GMT, Shaojin Wen wrote: >> Brian Burkhalter has updated the pull request incrementally with two >> additional commits since the last revision: >> >> - 8354724: Increment copyright year in Reader >> - 8354724: Move readString from BufferedReader to Reader > > src/j

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-17 Thread Shaojin Wen
On Thu, 17 Apr 2025 23:07:35 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with two > additional commits since the last revision: > > - 8354724: Increment copyright year in Reader > - 835

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-17 Thread Chen Liang
On Fri, 18 Apr 2025 02:45:56 GMT, Chen Liang wrote: >> We need to provide a StringBuilder that creates a coder of UTF16 to avoid >> the unnecessary UTF16 to LATIN1 conversion overhead here. >> >> If we do not want to add a new public method, we can add an internal method >> and expose it thro

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-17 Thread Shaojin Wen
On Thu, 17 Apr 2025 23:07:35 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with two > additional commits since the last revision: > > - 8354724: Increment copyright year in Reader > - 835

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v5]

2025-04-17 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with two additional commits since the last revision: - 8354724: Increment copyright year in Reader - 8354724: Move readString from BufferedReader to Reader - Chan

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v4]

2025-04-17 Thread Roger Riggs
On Thu, 17 Apr 2025 22:13:06 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Change the test to reuse a ByteBuffer when wr

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v4]

2025-04-17 Thread Brian Burkhalter
On Thu, 17 Apr 2025 22:13:06 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Change the test to reuse a ByteBuffer when wr

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v4]

2025-04-17 Thread Stuart Marks
On Thu, 17 Apr 2025 22:13:06 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Change the test to reuse a ByteBuffer when wr

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v4]

2025-04-17 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Change the test to reuse a ByteBuffer when writing the file - Changes: - all: https://git.openjdk.o

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v2]

2025-04-17 Thread Brian Burkhalter
On Thu, 17 Apr 2025 19:08:52 GMT, Roger Riggs wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Address all PR comments to now > > src/java.base/share/classes/java/io/BufferedReader.java line 417: > >>

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v2]

2025-04-17 Thread Roger Riggs
On Thu, 17 Apr 2025 19:34:13 GMT, Chen Liang wrote: > I don't see how `readString` is particularly line oriented; making > `readAllLines` specific to `BufferedReader` makes sense. Put another way, I don't think it makes sense to break up the higher level APIs across classes. The buffering prov

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v2]

2025-04-17 Thread Chen Liang
On Thu, 17 Apr 2025 18:45:13 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Address all PR comments to now I don't see h

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v2]

2025-04-17 Thread Roger Riggs
On Thu, 17 Apr 2025 18:45:13 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Address all PR comments to now The base `Rea

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v2]

2025-04-17 Thread Brian Burkhalter
On Thu, 17 Apr 2025 17:30:06 GMT, Johannes Graham wrote: >> test/jdk/java/io/BufferedReader/ReadAll.java line 34: >> >>> 32: >>> 33: import java.io.BufferedReader; >>> 34: import java.io.File; >> >> Cosmetic thought - I think this could all be done with Path, avoiding File >> and friends. > >

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v2]

2025-04-17 Thread Brian Burkhalter
On Thu, 17 Apr 2025 17:05:54 GMT, Alan Bateman wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Address all PR comments to now > > src/java.base/share/classes/java/io/BufferedReader.java line 440: > >>

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v2]

2025-04-17 Thread Brian Burkhalter
On Thu, 17 Apr 2025 17:19:03 GMT, Chen Liang wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Address all PR comments to now > > src/java.base/share/classes/java/io/BufferedReader.java line 419: > >> 4

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v2]

2025-04-17 Thread Brian Burkhalter
On Thu, 17 Apr 2025 16:42:54 GMT, Brian Burkhalter wrote: >> src/java.base/share/classes/java/io/BufferedReader.java line 459: >> >>> 457: * @since 25 >>> 458: */ >>> 459: public String readString() throws IOException { >> >> Suggestion: >> >> public String readString() thro

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v2]

2025-04-17 Thread Brian Burkhalter
> Implement the requested methods and add a test thereof. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8354724: Address all PR comments to now - Changes: - all: https://git.openjdk.org/jdk/pull/24728/files - n

Re: RFR: 8354724: BufferedReader readAllLines and readString methods

2025-04-17 Thread Brian Burkhalter
On Thu, 17 Apr 2025 17:20:57 GMT, Chen Liang wrote: > Is there a particular reason that these methods should exist only on > `BufferedReader` but not the base `Reader`? Good question. Perhaps @RogerRiggs could comment on that. - PR Comment: https://git.openjdk.org/jdk/pull/24728#i

Re: RFR: 8354724: BufferedReader readAllLines and readString methods

2025-04-17 Thread Brian Burkhalter
On Thu, 17 Apr 2025 16:18:55 GMT, Brian Burkhalter wrote: > Implement the requested methods and add a test thereof. > /csr needed I was going to do that _after_ consensus had been achieved here. It's extra work to create a CSR before that point, especially as that point might not be reached.

Re: RFR: 8354724: BufferedReader readAllLines and readString methods

2025-04-17 Thread Johannes Graham
On Thu, 17 Apr 2025 16:18:55 GMT, Brian Burkhalter wrote: > Implement the requested methods and add a test thereof. test/jdk/java/io/BufferedReader/ReadAll.java line 34: > 32: > 33: import java.io.BufferedReader; > 34: import java.io.File; Cosmetic thought - I think this could all be done wit

Re: RFR: 8354724: BufferedReader readAllLines and readString methods

2025-04-17 Thread Johannes Graham
On Thu, 17 Apr 2025 17:28:12 GMT, Johannes Graham wrote: >> Implement the requested methods and add a test thereof. > > test/jdk/java/io/BufferedReader/ReadAll.java line 34: > >> 32: >> 33: import java.io.BufferedReader; >> 34: import java.io.File; > > Cosmetic thought - I think this could all

Re: RFR: 8354724: BufferedReader readAllLines and readString methods

2025-04-17 Thread Chen Liang
On Thu, 17 Apr 2025 16:18:55 GMT, Brian Burkhalter wrote: > Implement the requested methods and add a test thereof. Is there a particular reason that these methods should exist only on `BufferedReader` but not the base `Reader`? Similar read-all operation `InputStream::readAllBytes` exists on

Re: RFR: 8354724: BufferedReader readAllLines and readString methods

2025-04-17 Thread Alan Bateman
On Thu, 17 Apr 2025 16:18:55 GMT, Brian Burkhalter wrote: > Implement the requested methods and add a test thereof. src/java.base/share/classes/java/io/BufferedReader.java line 440: > 438: * Reads all characters into a string. > 439: * > 440: * This method reads all content incl

Re: RFR: 8354724: BufferedReader readAllLines and readString methods

2025-04-17 Thread Brian Burkhalter
On Thu, 17 Apr 2025 16:36:53 GMT, Hendrik Schick wrote: >> Implement the requested methods and add a test thereof. > > src/java.base/share/classes/java/io/BufferedReader.java line 459: > >> 457: * @since 25 >> 458: */ >> 459: public String readString() throws IOException { > > Su

Re: RFR: 8354724: BufferedReader readAllLines and readString methods

2025-04-17 Thread Brian Burkhalter
On Thu, 17 Apr 2025 16:18:55 GMT, Brian Burkhalter wrote: > Implement the requested methods and add a test thereof. A CSR will be filed if the discussion in this request converges to consensus. - PR Comment: https://git.openjdk.org/jdk/pull/24728#issuecomment-2813488383

Re: RFR: 8354724: BufferedReader readAllLines and readString methods

2025-04-17 Thread Hendrik Schick
On Thu, 17 Apr 2025 16:18:55 GMT, Brian Burkhalter wrote: > Implement the requested methods and add a test thereof. src/java.base/share/classes/java/io/BufferedReader.java line 459: > 457: * @since 25 > 458: */ > 459: public String readString() throws IOException { Suggestion:

RFR: 8354724: BufferedReader readAllLines and readString methods

2025-04-17 Thread Brian Burkhalter
Implement the requested methods and add a test thereof. - Commit messages: - 8354724: BufferedReader readAllLines and readString methods Changes: https://git.openjdk.org/jdk/pull/24728/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24728&range=00 Issue: https://bugs.open