Package net.bnubot.util.task

Examples of net.bnubot.util.task.Task


  public static void flush() throws Exception {
    int num = queue.size();
    if(num <= 0)
      return;

    Task t = TaskManager.createTask("Download", num, "files");
    for(FileDownload fd : queue) {
      downloadURLNow(fd.url, fd.to, fd.sha1, fd.force);
      t.advanceProgress();
    }
    t.complete();
    queue.clear();
  }
View Full Code Here


    DataInputStream is = new DataInputStream(new BufferedInputStream(uc.getInputStream()));
    FileOutputStream os = new FileOutputStream(to);
    byte[] b = new byte[1024];

    int fileLength = uc.getHeaderFieldInt("Content-Length", 0) / b.length;
    Task task = null;
    if(fileLength > 0)
      task = TaskManager.createTask(url.toExternalForm(), fileLength, "kB");

    do {
      int c = is.read(b);
      if(c == -1)
        break;
      os.write(b, 0, c);
      if(task != null)
        task.advanceProgress();
    } while(true);

    if(task != null)
      task.complete();

    os.close();
    is.close();
  }
View Full Code Here

    // Start the Connection thread
    con.start();

    // Wait for the Connection thread to initialize
    Task t = TaskManager.createTask("Initializing " + con.toShortString());
    while(!con.isInitialized()) {
      Thread.sleep(10);
      Thread.yield();
    }
    t.complete();

    Out.setThreadOutputHandler(null);
    return true;
  }
View Full Code Here

  protected AcceptOrDecline lastAcceptDecline = null;
  public int enabledCryptos = 0;

  protected Task createTask(String title, String currentStep) {
    Task t = TaskManager.createTask(profile.getName() + ": " + title, currentStep);
    currentTasks.add(t);
    return t;
  }
View Full Code Here

    currentTasks.add(t);
    return t;
  }

  protected Task createTask(String title, int max, String units) {
    Task t = TaskManager.createTask(title, max, units);
    currentTasks.add(t);
    return t;
  }
View Full Code Here

          }
        }

        connectionState = ConnectionState.CONNECTING;
        dispatchTitleChanged();
        Task connect = createTask("Connecting to " + getServer() + ":" + getPort(), "Verify connection settings validity");

        if(!cs.isInitialized()) {
          if(PluginManager.getEnableGui()) {
            new NewProfileWizard(cs).displayAndBlock();
          }
View Full Code Here

          warden = null;
          warden_seed = new byte[4];
          System.arraycopy(keyHash, 16, warden_seed, 0, 4);
        }

        Task task = createTask("BNLS_VERSIONCHECKEX2", "...");
        VersionCheckResult vcr = BNLSManager.sendVersionCheckEx2(task, productID, mpqFileTime, mpqFileName, valueStr);
        completeTask(task);

        if(vcr == null) {
          dispatchRecieveError("CheckRevision failed.");
View Full Code Here

TOP

Related Classes of net.bnubot.util.task.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.