欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

[FW:] Writing big files to ServletOutputStre

系統 1836 0

Problem when writing big files to ServletOutputStream

I am using the following code to write files to servlet output stream. The problem is the browser is not downloading the entire file when the file size grows above 10 MB. Any help would be greatly helpful.

FileInputStream fis = new FileInputStream(new File(fileName));
response.setHeader("Content-Disposition:", "attachment;filename=" + fileName );
BufferedInputStream bis= new BufferedInputStream(fis);
ServletOutputStream sos = response.getOutputStream();
byte[] buffer = new byte[5000];
response.setHeader("Content-Length:", String.valueOf (bis.available()));
while (true) {
int bytesRead = bis.read(buffer, 0, buffer.length);
if (bytesRead < 0)
break;
sos.write(buffer, 0, bytesRead);
}
fis.close();
sos.flush();
sos.close();

<!-- <form class="userinput"> <div class="center"><button type="submit" onmouseover="this.className='over'" onmouseout="this.className='';" onmousedown="this.className='down'">Post reply</button></div> </form> -->
<!-- header -->
<!-- info --> Message #141567 <!-- button --> Mark as noisy Mark as noisy Mark as noisy <!-- button --> Post reply Post reply Post reply <!-- button --> Go to top Go to top Go to top

Problem when writing big files to ServletOutputStream

Posted By: Krishnan Muthusubramanian on October 06, 2004 @ 11:45 AM in response to Message #141542 0 replies in this thread
response.setHeader("Content-Length:", String.valueOf (bis.available()));
The 'available' method of InputStream does not return the number of bytes that avilable :). Check the Java Doc for this method.

Try new File(fileName).length() instead

[FW:] Writing big files to ServletOutputStream


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 久久日本精品99久久久久 | 在线国产一区 | 国产色图片 | 国产成人a| 精品精品| 欧美激情综合网 | 四虎影视永久免费观看网址 | 精品久久久久久蜜臂a∨ | 91亚洲一区 | 日韩综合在线 | 一级片在线视频 | 中文乱码一二三四有限公司 | 5c5c5c精品视频在线观看 | 性福利影院 | 日韩丝袜在线观看 | 国产精品一区二555 欧美在线免费 | 国产人妻精品无码AV在线浪潮 | 亚洲国产一区二区三区四区 | 91久久精品国产一区二区 | 午夜欧美精品 | 日日狠日 | 精品人人视屏 | 午夜影院恐怖电影免费看 | 成人影院av| 狠狠干综合 | 国产精品久久久久久久久久红粉 | 日韩电影免费在线观看中文字幕 | 亚洲精品久久婷婷丁香51 | 五月激情六月 | 激情丁香婷婷 | 99爱在线精品视频免费观看9 | 欧美激烈精交gif动态图18p | 天天做天天添婷婷我也去 | 在线观看亚洲一区二区 | 免费一区二区三区免费视频 | 九九国产 | 久久国产精品免费一区二区三区 | 亚洲综合色一区二区三区另类 | 久久精品在线 | 久久国产一二区 | 免费观看一级特黄欧美大片 |