Skip to content

Commit f4eefc6

Browse files
committed
Construct StringBuilder in StreamUtils with appropriate initial size
Closes gh-25789
1 parent 6124a3f commit f4eefc6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-core/src/main/java/org/springframework/util/StreamUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static String copyToString(@Nullable InputStream in, Charset charset) thr
8383
return "";
8484
}
8585

86-
StringBuilder out = new StringBuilder();
86+
StringBuilder out = new StringBuilder(BUFFER_SIZE);
8787
InputStreamReader reader = new InputStreamReader(in, charset);
8888
char[] buffer = new char[BUFFER_SIZE];
8989
int charsRead;

0 commit comments

Comments
 (0)