Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public File unpackClient(URL url, File targetDir, String clientname) throws IOException {
  2.       if(!targetDir.exists()) {
  3.          targetDir.mkdirs();
  4.       }
  5.       this.theme.setAuth("Скачивание обновления " + clientname);
  6.       URLConnection urlconnection = url.openConnection();
  7.       this.totalDownload = urlconnection.getContentLength() / 1024;
  8.       this.onePercent = (double)(this.totalDownload / 100);
  9.       BufferedInputStream in = new BufferedInputStream(url.openStream(), 1024);
  10.       File zip = File.createTempFile("client", ".zip", targetDir);
  11.       BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(zip));
  12.       this.copyInputStream(in, out, false);
  13.       out.close();
  14.       return this.unpackArchive(zip, targetDir);
  15.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement