public String downloadNet(String downUrl, String file1) throws MalformedURLException {
// 下载网络文件
String path = "";
int bytesum = 0;
int byteread = 0;
String packages = extractString(downUrl);
String saveFileName = String.valueOf(System.currentTimeMillis()) + Math.round(Math.random() * 100000);
URL url = new URL(downUrl);
try {
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(file1 + File.separator + saveFileName + ".apk");
path=file1+saveFileName + ".apk";
byte[] buffer = new byte[1204];
int length;
while ((byteread = inStream.read(buffer)) != -1) {
bytesum += byteread;
System.out.println(bytesum);
fs.write(buffer, 0, byteread);
}
if(null!=fs){
try {
fs.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return path;
}