Package ch.ethz.ssh2

Examples of ch.ethz.ssh2.StreamGobbler


  {
    checkHandleValidAndOpen(handle);

    int req_id = generateNextRequestID();

    TypesWriter tw = new TypesWriter();
    tw.writeString(handle.fileHandle, 0, handle.fileHandle.length);
    tw.writeBytes(createAttrs(attr));

    if (debug != null)
    {
      debug.println("Sending SSH_FXP_FSETSTAT...");
      debug.flush();
    }

    sendMessage(Packet.SSH_FXP_FSETSTAT, req_id, tw.getBytes());

    expectStatusOKMessage(req_id);
  }
View Full Code Here


    /* Either I am too stupid to understand the SFTP draft
     * or the OpenSSH guys changed the semantics of src and target.
     */

    TypesWriter tw = new TypesWriter();
    tw.writeString(target, charsetName);
    tw.writeString(src, charsetName);

    if (debug != null)
    {
      debug.println("Sending SSH_FXP_SYMLINK...");
      debug.flush();
    }

    sendMessage(Packet.SSH_FXP_SYMLINK, req_id, tw.getBytes());

    expectStatusOKMessage(req_id);
  }
View Full Code Here

      objSSHSession = this.getSshConnection().openSession();
      logger.debug("Executing command " + checkShellCommand);
      objSSHSession.execCommand(checkShellCommand);

      logger.debug("output to stdout for remote command: " + checkShellCommand);
      ipsStdOut = new StreamGobbler(objSSHSession.getStdout());
      ipsStdErr = new StreamGobbler(objSSHSession.getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(ipsStdOut));
      String stdOut = "";
      while (true) {
        String line = stdoutReader.readLine();
        if (line == null)
View Full Code Here

      }

      this.getSshSession().execCommand(strCmd);

      logger.debug("output to stdout for remote command: " + strCmd);
      ipsStdOut = new StreamGobbler(this.getSshSession().getStdout());
      ipsStdErr = new StreamGobbler(this.getSshSession().getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(ipsStdOut));
      strbStdoutOutput = new StringBuffer();
      while (true) {
        String line = stdoutReader.readLine();
        if (line == null)
View Full Code Here

            spooler_log.debug5("executing remote command: " + command);
            this.setSshSession(this.getSshConnection().openSession());
            this.getSshSession().execCommand(command);

            spooler_log.debug5("output to stdout for remote command: " + command);
            InputStream stdout = new StreamGobbler(this.getSshSession().getStdout());
            BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
            while (true) {
                String line = stdoutReader.readLine();
                if (line == null) break;
                spooler_log.info(line);
            }

            spooler_log.debug5("output to stderr for remote command: " + command);
            InputStream stderr = new StreamGobbler(this.getSshSession().getStderr());
            BufferedReader stderrReader = new BufferedReader(new InputStreamReader(stderr));
            String stderrOutput = "";
            while (true) {
                String line = stderrReader.readLine();
                if (line == null) break;
View Full Code Here

      spooler_log.debug5("fetching children");
      this.getSshSession().execCommand("/bin/ps -ef");

      spooler_log.debug9("output to stdout for ps command: ");
      stdout = new StreamGobbler(this.getSshSession().getStdout());
      stderr = new StreamGobbler(this.getSshSession().getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
      String line = stdoutReader.readLine(); //Ueberschrift
      spooler_log.debug9(line);

View Full Code Here

  private void executeCommand(String command, int logLevel) throws Exception{
    Session session = getSshConnection().openSession();
    try{
      session.execCommand(command);
      spooler_log.log(logLevel,"output to stdout for remote command: " + command);
      stdout = new StreamGobbler(this.getSshSession().getStdout());
      stderr = new StreamGobbler(this.getSshSession().getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));

      while (true) {
        String line = stdoutReader.readLine();
        if (line == null) break;
View Full Code Here

            }

            this.getSshSession().execCommand(currentCommand);

            getLogger().debug("output to stdout for remote command: " + normalizedPassword(this.getCommands()[i]));
            stdout = new StreamGobbler(this.getSshSession().getStdout());
            stderr = new StreamGobbler(this.getSshSession().getStderr());
            BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
            int pid = 0;
            while (true) {
              String line = stdoutReader.readLine();
              if (line == null)
View Full Code Here

      session = this.getSshConnection().openSession();
      getLogger().debug9("Executing command " + checkShellCommand);
      session.execCommand(checkShellCommand);

      getLogger().debug9("output to stdout for remote command: " + checkShellCommand);
      stdout = new StreamGobbler(session.getStdout());
      stderr = new StreamGobbler(session.getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
      String stdOut = "";
      while (true) {
        String line = stdoutReader.readLine();
        if (line == null)
View Full Code Here

    }
    try {
      session = conn.openSession();
      final String path = uri.getPath();
      session.execCommand(String.format("hg -R %s serve --stdio", path.charAt(0) == '/' ? path.substring(1) : path));
      remoteErr = new StreamGobbler(session.getStderr());
      remoteOut = new StreamGobbler(session.getStdout());
      remoteIn = session.getStdin();
      sessionUse = 1;
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Failed to create ssh session", ex);
    }
View Full Code Here

TOP

Related Classes of ch.ethz.ssh2.StreamGobbler

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.