public void downloadPlug(String downloadUrl,String savePath) {
try {
URL url = new URL(downloadUrl);
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();
int contentLength = conn.getContentLength();
File downLoadFile = new File(savePath);
if (downLoadFile.exists()) {
downLoadFile.delete();
}
byte[] bs = new byte[1024];
int len;
OutputStream os = new FileOutputStream(downLoadFile);
while ((len = is.read(bs)) != -1) {
os.write(bs, 0, len);
}
os.close();
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}