我正在开发一个程序来转换 StreamingOutput,我需要转换为 InputStream 以保存在 myFilSytem 中。 我尝试遵循代码,但它无法正确转换。
InputStream convertToInputStream(StreamingOutput output) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
output.write(outputStream);
} catch (IOException e) {
throw new WebApplicationException("Error writing to output stream", e);
}
return new ByteArrayInputStream(outputStream.toByteArray());
}
does this needs any correction or do we have any better way for converting
Streamingoutput 包含文档,需要转换为 inputStream 才能发送给其他微服务。