Skip to content

Commit ecc6a5a

Browse files
philwebbrstoyanchev
authored andcommitted
Improve SimpleStreamingClientHttpRequest performance
Ensure that NonClosingOutputStream calls with a byte array call the corresponding methods of the underlying OutputStream rather than relying on the default NonClosingOutputStream implementation, which writes one bte at a time. This significantly improves performance. Issues: SPR-9530
1 parent dc822cd commit ecc6a5a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spring-web/src/main/java/org/springframework/http/client/SimpleStreamingClientHttpRequest.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2011 the original author or authors.
2+
* Copyright 2002-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -113,6 +113,16 @@ private NonClosingOutputStream(OutputStream out) {
113113
super(out);
114114
}
115115

116+
@Override
117+
public void write(byte[] b) throws IOException {
118+
super.write(b);
119+
}
120+
121+
@Override
122+
public void write(byte[] b, int off, int let) throws IOException {
123+
out.write(b, off, let);
124+
}
125+
116126
@Override
117127
public void close() throws IOException {
118128
}

0 commit comments

Comments
 (0)