Code example for URLConnection

Methods: getContentLength, getInputStream

0
      IProgressMonitor monitor) throws IOException {
 
    URLConnection connection = downloadUrl.openConnection();
    FileOutputStream out = new FileOutputStream(destFile);
 
    int length = connection.getContentLength();
 
    monitor.beginTask(taskName, length);
    copyStream(connection.getInputStream(), out, monitor, length);
    monitor.done();
  } 
 
  /** 
   * Ensure that the execute bit is set on the given files. 
   *  
   * @param files the files that should be executable 
   */ 
  public static void ensureExecutable(File... files) {
    if (files != null) {
      for (File file : files) {
        if (!file.canExecute()) {