我有一个我想要写入HttpServletResponse的InputStream.这种方法由于使用byte []而花费的时间太长
InputStream is = getInputStream();
int contentLength = getContentLength();
byte[] data = new byte[contentLength];
is.read(data);
//response here is the HttpServletResponse object
response.setContentLength(contentLength);
response.write(data);
Run Code Online (Sandbox Code Playgroud)
在速度和效率方面,我想知道什么是最好的方法.