Examples of StreamGobbler


Examples of com.trilead.ssh2.StreamGobbler

        // 4. launch process.
        try {
            myProcess = Runtime.getRuntime().exec(process);
            myInputStream = new BufferedInputStream(myProcess.getInputStream());
            myOutputStream = new BufferedOutputStream(myProcess.getOutputStream());
            new StreamGobbler(myProcess.getErrorStream());
        } catch (IOException e) {
            try {
                close(repository);
            } catch (SVNException inner) {
            }
View Full Code Here

Examples of com.trilead.ssh2.StreamGobbler

                    }
                    myOutputStream = mySession.getStdin();
                    myOutputStream = new BufferedOutputStream(myOutputStream, 16*1024);
                    myInputStream = mySession.getStdout();
                    myInputStream = new BufferedInputStream(myInputStream, 16*1024);
                    new StreamGobbler(mySession.getStderr());
                    myConnection = connection;
                    return;
                } catch (SocketTimeoutException e) {
                  SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_IO_ERROR, "timed out waiting for server", null, SVNErrorMessage.TYPE_ERROR, e);
                    SVNErrorManager.error(err, e, SVNLogType.NETWORK);
View Full Code Here

Examples of edu.stanford.nlp.util.StreamGobbler

    this.filename = filename;
    OutputStream outStream = new FileOutputStream(filename);
    errWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(err)));
    outGobbler = new ByteStreamGobbler("Output stream gobbler: " + cmd + " " + filename,
            process.getInputStream(), outStream);
    errGobbler = new StreamGobbler(process.getErrorStream(), errWriter);
    outGobbler.start();
    errGobbler.start();
  }
View Full Code Here

Examples of helpers.StreamGobbler

    ProcessBuilder pb = new ProcessBuilder(args);
    pb.directory(new File(path));

    Process sumo = pb.start();

    StreamGobbler gi = new StreamGobbler(sumo.getInputStream());
    StreamGobbler ge = new StreamGobbler(sumo.getErrorStream());

    gi.start();
    ge.start();

    int exitvalue = sumo.waitFor();

    gi.stop();
    ge.stop();

    List<String> gir = gi.getReadLines();
    List<String> ger = ge.getReadLines();

    for (String s : ger) {
      System.out.println(s);
    }
  }
View Full Code Here

Examples of helpers.StreamGobbler

        ProcessBuilder pb = new ProcessBuilder(args);
        pb.directory(new File(sim.getExportPath()));

        Process dua = pb.start();

        StreamGobbler gi = new StreamGobbler(dua.getInputStream());
        StreamGobbler ge = new StreamGobbler(dua.getErrorStream());

        gi.start();
        ge.start();

        int exitvalue = dua.waitFor();

        gi.stop();
        ge.stop();

        List<String> gir = gi.getReadLines();
        List<String> ger = ge.getReadLines();

        for (String s : ger) {
          System.out.println(s);
        }
      } catch (Exception e) {
View Full Code Here

Examples of me.mabra.hellonzb.util.StreamGobbler

   
    // execute command
    String [] cmdArray = cmd.toArray(new String[] {});
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(cmdArray, null, destination);
    StreamGobbler errGobbler = new StreamGobbler(logger, proc.getErrorStream(), "Unrar (Error)");
    StreamGobbler outGobbler = new StreamGobbler(logger, proc.getInputStream(), "Unrar");
   
    // fetch command's STDOUT and STDERR
    errGobbler.start();
    outGobbler.start();
   
    // wait until program has finished
    int exitVal = proc.waitFor();
    logger.msg("Unrar command exit value: " + exitVal, MyLogger.SEV_INFO);

    // get RAR archive part file names
    for(String line : outGobbler.getLines())
    {
      String l = line.trim();
      if(l.startsWith("Extracting from "))
        rarPartFiles.add(l.substring(16));
    }
View Full Code Here

Examples of org.intellij.sonar.console.StreamGobbler

      process = Runtime.getRuntime().exec(this.sourceCode.split("[\\s]+"), null, this.workingDir);
    } catch (IOException e) {
      sonarConsole.error(Throwables.getStackTraceAsString(e));
      return;
    }
    final StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), sonarConsole, ERROR);
    final StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), sonarConsole, INFO);
    errorGobbler.start();
    outputGobbler.start();

    final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
    indicator.setIndeterminate(true);

    while (outputGobbler.isAlive()) {
      if (indicator.isCanceled()) {
        process.destroy();
        break;
      }
    }
View Full Code Here

Examples of org.rssowl.core.util.StreamGobbler

    else if (Application.IS_MAC) {
      try {
        Process proc = Runtime.getRuntime().exec("/usr/bin/open " + link); //$NON-NLS-1$

        /* Let StreamGobbler handle error message */
        StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream());

        /* Let StreamGobbler handle output */
        StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream());

        /* Flush both error and output streams */
        errorGobbler.schedule();
        outputGobbler.schedule();
      }

      /* Show error message, default browser could not be launched */
      catch (IOException e) {
        Activator.getDefault().logError(e.getMessage(), e);
        showErrorIfExternalBrowserFails();
      }
    }

    /* Launch default browser on Linux & Solaris */
    else {

      /* Run browser in a seperate thread */
      Thread launcher = new Thread("") { //$NON-NLS-1$
        @Override
        public void run() {
          try {

            /* Return early if shutting down */
            if (Controller.getDefault().isShuttingDown())
              return;

            /* The default browser was successfully launched once, use again */
            if (webBrowserSuccessfullyOpened) {
              Process proc = Runtime.getRuntime().exec(webBrowser + " -remote openURL(" + link + ")"); //$NON-NLS-1$ //$NON-NLS-2$

              /* Let StreamGobbler handle error message */
              StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream());

              /* Let StreamGobbler handle output */
              StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream());

              /* Flush both error and output streams */
              errorGobbler.schedule();
              outputGobbler.schedule();
            }

            /* The default browser was not yet launched, try NS and Mozilla */
            else {
              Process proc = openWebBrowser(link);
              webBrowserSuccessfullyOpened = true;

              if (proc != null) {

                /* Let StreamGobbler handle error message */
                StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream());

                /* Let StreamGobbler handle output */
                StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream());

                /* Flush both error and output streams */
                errorGobbler.schedule();
                outputGobbler.schedule();
              }

              /* Wait for this process */
              try {
                if (proc != null)
View Full Code Here

Examples of org.rssowl.core.util.StreamGobbler

        /* Execute custom browser */
        try {
          Process proc = Runtime.getRuntime().exec(executable);

          /* Let StreamGobbler handle error message */
          StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream());

          /* Let StreamGobbler handle output */
          StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream());

          /* Flush both error and output streams */
          errorGobbler.schedule();
          outputGobbler.schedule();

          /* Wait for the process to terminate */
          proc.waitFor();
        } catch (IOException e) {
          Activator.safeLogError(e.getMessage(), e);
View Full Code Here

Examples of org.rssowl.core.util.StreamGobbler

      OutputStream outputStream = proc.getOutputStream();
      outputStream.write(message.toString().getBytes());
      outputStream.close();

      /* Let StreamGobbler handle error message */
      StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream());

      /* Let StreamGobbler handle output */
      StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream());

      /* Flush both error and output streams */
      errorGobbler.schedule();
      outputGobbler.schedule();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.