/** 将 ByteArrayInputStream 拷贝成 ByteArrayOutputStream
* 将 字节数组输入流 拷贝成 字节数组输出流
*/
public static ByteArrayOutputStream getByteArrayOutputStream(ByteArrayInputStream inputStream) throws IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, length);
}
return outputStream;
}
标签:outputStream,字节,ByteArrayInputStream,数组,ByteArrayOutputStream,拷贝
From: https://www.cnblogs.com/kakarotto-chen/p/17362842.html