On Sat, 17 Sep 2022 21:43:04 GMT, Andrey Turbanov <[email protected]> wrote:
> There a few unnecessary usages of StringBuffer in SQLOutputImpl class.
> All of them create StringBuffer from single character and then concatenate
> with String. Instead of this, we can concatenate character directly.
src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java
line 328:
> 326: try {
> 327: int i;
> 328: while ((i = bufReader.read()) != -1) {
Is the single character read really necessary?
BufferedReader.readLine() returns null on EOF.
It seems plausable that only the readLine and writeString are needed in the
loop.
Similarly, for the read loops below for InputStreams and binary stream.
The BufferedReader and readline can be used for the binary streams by
constructing with the ASCII Charset.
-------------
PR: https://git.openjdk.org/jdk/pull/10320