8229022: BufferedReader performance can be improved by using StringBuilder
Reviewed-by: igerasim, vtewari, dfuchs
This commit is contained in:
parent
85a62dcc5c
commit
c1b844a225
@ -314,7 +314,7 @@ public class BufferedReader extends Reader {
|
|||||||
* @throws IOException If an I/O error occurs
|
* @throws IOException If an I/O error occurs
|
||||||
*/
|
*/
|
||||||
String readLine(boolean ignoreLF, boolean[] term) throws IOException {
|
String readLine(boolean ignoreLF, boolean[] term) throws IOException {
|
||||||
StringBuffer s = null;
|
StringBuilder s = null;
|
||||||
int startChar;
|
int startChar;
|
||||||
|
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
@ -372,7 +372,7 @@ public class BufferedReader extends Reader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s == null)
|
if (s == null)
|
||||||
s = new StringBuffer(defaultExpectedLineLength);
|
s = new StringBuilder(defaultExpectedLineLength);
|
||||||
s.append(cb, startChar, i - startChar);
|
s.append(cb, startChar, i - startChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user