【发布时间】:2012-04-25 21:51:34
【问题描述】:
我有一个要写入 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);
我想知道就速度和效率而言,最好的方法是什么。
【问题讨论】:
标签: java jakarta-ee servlets inputstream outputstream