**[Juergen Hoeller](https://jira.spring.io/secure/ViewProfile.jspa?name=juergen.hoeller)** opened **[SPR-11646](https://jira.spring.io/browse/SPR-11646?redirect=false)** and commented MarshallingView's current code: ``` StreamUtils.copy(baos.toByteArray(), response.getOutputStream()); ``` can be optimized to: ``` baos.writeTo(response.getOutputStream()); ``` in order to avoid the temporary copy in a byte array. --- **Affects:** 3.2.8, 4.0.3 **Issue Links:** - #16038 MarshallingView should not close response output stream - #16267 ResourceHttpRequestHandler not closing Resource's input stream **Backported to:** [3.2.9](https://github.com/spring-projects/spring-framework/milestone/97?closed=1)