本帖最后由 黑马-蒋振军 于 2013-4-14 14:54 编辑
- InputStream in = null;
- OutputStream out = null;
- try {
- in = request.getInputStream();
- out = response.getOutputStream();
-
- byte[] buf = new byte[1024];
- int len = 0;
-
- while ((len=in.read(buf)) != -1) {
- System.out.println(len);
- out.write(buf, 0, len);
- }
- } finally{
-
- if (out != null){
- out.close();
- }
-
- if (in != null){
- in.close();
- }
-
- }
复制代码 结果输出:
1024
1024
1024
1024
1024
1024
1024
497
1024
1024
1024
1024
1024
1024
1024
497
1024
1024
1024
1024
1024
1024
1024
497
1024
1024
1024
1024
1024
1024
1024
497
1024
1024
1024
.......
|