PRagma: no-cache 以上三個頭一起用,就可以控制所有的瀏覽器不要緩存數據
Range bytes=6- 實現斷點續傳
URL url=new URL("http://localhost:8080/myday04/1.txt");URLConnection conn=url.openConnection();conn.setRequestProperty("Range", "bytes=6-");InputStream in=conn.getInputStream();byte[] buffer=new byte[1024];int len=0;FileOutputStream out=new FileOutputStream("D://1.txt",true);while((len=in.read(buffer))>0){out.write(buffer,0,len);}out.close();in.close();
新聞熱點
疑難解答