将文件写入ServletOutputStream的最有效方法

IAdapter:
ServletOutputStream output = response.getOutputStream();
output.write(byte[]);

将File写入javax.servlet.ServletOutputStream的最有效方法是什么?

编辑:

如果使用NIO会更有效吗?

亚历克斯
IOUtils.copy(in, out);
out.flush();
//...........
out.close(); // depends on your application

哪里in的FileInputStreamoutSocketOutputStreamIOUtilsApache Commons中Commons IO模块的实用程序

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章