?? inputstream.jsp
字號:
1 <%@ page contentType="text/html;charset=gb2312"%>
2 <%@ page import="java.io.*"%>
3 <%@ page import="java.net.*"%>
4 <%
5 int bytesum=0;
6 int byteread=0;
7 //下載文件的鏈接地址
8 URL url = new URL("http://game.china.com/zh_cn/download/cheats/hero3_cool.zip");
9 URLConnection conn = url.openConnection();
10 InputStream inStream = conn.getInputStream();
11 //下載文件的存放路徑
12 FileOutputStream fs=new FileOutputStream("c:/xx.zip");
13 byte[] buffer =new byte[1444];
14 while ((byteread=inStream.read(buffer))!=-1)
15 {
16 out.println("<DT><B>"+byteread+"</B></DT>");
17 bytesum+=byteread;
18 //System.out.println(bytesum);
19 fs.write(buffer,0,byteread);
20 }
21 %>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -