一段java下载的程序参考
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Properties;
public class Down {
/**
* @param args
*/
private static int downloaded; // number of bytes downloaded
private static final int MAX_BUFFER_SIZE = 1024;
private static int size; // size of download in bytes
public static void main(String[] args) throws Exception{
downloaded = 0;
size=0;
String url = "http://ime.sogou.com/dl/sogou_pinyin_42l.exe";
String proxy = "proxy.zte.com.cn";
String hosturl = url.substring(7, url.indexOf("/", 7));
String requesturl = url.substring(hosturl.length()+7);
//URL url1 = new URL(proxy + requesturl);
URL url1 = new URL(url);
HttpURLConnection connection =
(HttpURLConnection) url1.openConnection();
//connection.setRequest
相关问答:
我目前在本地的linux上写了一个swing的界面,想通过这个界面来控制其它电脑的linux重启。
我知道用Runtime.getRuntime().exec("shutdown -r");可以控制本机Linux重启,但是怎么控制远程的linux重启呢? ......
我的开发的平台是Myeclipes6.0 + tomcat5.x + mysql
我所有的编码方式都是用的UTF-8
我只用了Strtus框架
在一个form中如下用的是post的提交方式:
<form class="form" action=&quo ......
查API,看到FeatrueFactory有这个方法
public Feature createPolyLine(double[][] thePoints,
R ......
我想使用Lucene的代码,发现要import一批文件:
============
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
………………
===== ......
我在eclipse中写了一个播放音乐的类,并把音乐文件和类文件放在了一起,结果运行时,出现错误,说是音乐文件那个是空的,但是在jcreator用同样的方法结果是可以运行的,请求高说指教,告诉为什么?急
你若是在Windo ......