jdk是8.0版本ServletOutputStream转换ByteArrayOutputStream
时间: 2023-10-25 07:04:35 浏览: 170
jdk8.0版本
5星 · 资源好评率100%
在 JDK 8.0 版本中,要将 ServletOutputStream 转换为 ByteArrayOutputStream,可以使用以下代码:
```java
ServletOutputStream servletOutputStream = response.getOutputStream();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
int bytesRead;
byte[] buffer = new byte<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [关于java:如何获取InputStream的大小?](https://blog.csdn.net/weixin_39897267/article/details/111844555)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文