且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-11-25 11:05:28

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

中的 FileInputStream out SocketOutputStream
IOUtils 是来自 Apache Commons 中的http://commons.apache.org/io/\">Commons IO 模块。

Where in is the FileInputStream and out is the SocketOutputStream. IOUtils is a utility from Commons IO module in Apache Commons.