Package com.jcraft.jsch

Examples of com.jcraft.jsch.ChannelSftp.disconnect()


            try
            {
                // maybe the channel has some problems, so recreate the channel and retry
                if (e.id != ChannelSftp.SSH_FX_NO_SUCH_FILE)
                {
                    channel.disconnect();
                    channel = fileSystem.getChannel();
                    setStat(channel.stat(relPath));
                }
                else
                {
View Full Code Here


        assertEquals("0123456789", readFile(unixPath));

        OutputStream os = c.put(unixPath, null, ChannelSftp.APPEND, -5);
        os.write("a".getBytes());
        os.close();
        c.disconnect();

        assertTrue(target.exists());
        assertEquals("01234a", readFile(unixPath));

        target.delete();
View Full Code Here

            }
        } finally {
            is.close();
        }

        c.disconnect();
        return new String(bos.toByteArray());
    }

    protected void sendFile(String path, String data) throws Exception {
        ChannelSftp c = (ChannelSftp) session.openChannel("sftp");
View Full Code Here

    protected void sendFile(String path, String data) throws Exception {
        ChannelSftp c = (ChannelSftp) session.openChannel("sftp");
        c.connect();
        c.put(new ByteArrayInputStream(data.getBytes()), path);
        c.disconnect();
    }

}
View Full Code Here

    }

    //

    channel.disconnect();

    final int status = channel.getExitStatus();

    session.disconnect();
View Full Code Here

      //prepare directory:
      ChannelSftp sftpChannel = (ChannelSftp)session.openChannel("sftp");
      try {
        sftpChannel.connect();
        prepareDirectory(sftpChannel);
        sftpChannel.disconnect();
      }
      finally {
        if (sftpChannel.isConnected())
          sftpChannel.disconnect();
      }
View Full Code Here

        prepareDirectory(sftpChannel);
        sftpChannel.disconnect();
      }
      finally {
        if (sftpChannel.isConnected())
          sftpChannel.disconnect();
      }

      //execute script:
      Shell shell = new Shell(session);
View Full Code Here

      try {
        rmdir(sftp, super.remotePath);
      }
      finally {
        if (sftp.isConnected())
          sftp.disconnect();
      }
    }
  }

  // ---------------------------------------------------- Files
View Full Code Here

            getDir(channel, remoteFile, localFile);
        } catch (SftpException e) {
            throw new JSchException(e.toString());
        } finally {
            if (channel != null) {
                channel.disconnect();
            }
        }
        log("done\n");
    }
View Full Code Here

            } catch (SftpException e) {
                throw new JSchException(e.toString());
            }
        } finally {
            if (channel != null) {
                channel.disconnect();
            }
        }
    }

    private void doMultipleTransfer() throws IOException, JSchException {
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.