byte[]转换成InputStream
时间: 2023-10-25 10:00:28 浏览: 182
C# Stream 和 byte[] 之间的转换
要将byte[]转换为InputStream,可以使用ByteArrayInputStream类。可以按照以下方式进行转换:
```java
byte[] byteArray = //your byte array here
InputStream inputStream = new ByteArrayInputStream(byteArray);
```
其中,`byteArray`是你的byte数组。通过将其传递给ByteArrayInputStream的构造函数,你将得到一个对应于该数组的输入流。<em>1</em><em>2</em>
#### 引用[.reference_title]
- *1* [将InputStream转换为byte数组](https://blog.csdn.net/fengsheng5210/article/details/78191734)[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^v92^chatsearchT3_1"}} ] [.reference_item]
- *2* [byte[]和InputStream的相互转换](https://blog.csdn.net/zz02111/article/details/84127776)[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^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文