Package net.schmizz.sshj.sftp

Examples of net.schmizz.sshj.sftp.SFTPClient


        ssh.loadKnownHosts();
        ssh.connect("localhost");
        try {
            ssh.authPublickey(System.getProperty("user.name"));
            final String src = System.getProperty("user.home") + File.separator + "test_file";
            final SFTPClient sftp = ssh.newSFTPClient();
            try {
                sftp.put(new FileSystemFile(src), "/tmp");
            } finally {
                sftp.close();
            }
        } finally {
            ssh.disconnect();
        }
    }
View Full Code Here


        final SSHClient ssh = new SSHClient();
        ssh.loadKnownHosts();
        ssh.connect("localhost");
        try {
            ssh.authPublickey(System.getProperty("user.name"));
            final SFTPClient sftp = ssh.newSFTPClient();
            try {
                sftp.get("test_file", new FileSystemFile("/tmp"));
            } finally {
                sftp.close();
            }
        } finally {
            ssh.disconnect();
        }
    }
View Full Code Here

     * @see StatefulSFTPClient
     */
    public SFTPClient newSFTPClient()
            throws IOException {
        assert isConnected() && isAuthenticated();
        return new SFTPClient(new SFTPEngine(this).init());
    }
View Full Code Here

     */
    public SFTPClient newSFTPClient()
            throws IOException {
        checkConnected();
        checkAuthenticated();
        return new SFTPClient(new SFTPEngine(this).init());
    }
View Full Code Here

        }

        checkConnection();

        try {
            SFTPClient sftpClient = sshSession.getSsh().newSFTPClient();
            List<File> files = new ArrayList<File>(paths.size());

            for (String path : paths) {
                final File destFile = new File(destParentDir, FilenameUtils.getName(path));

                logger.info("transferring {} to {}", path, destFile.getAbsolutePath());

                sftpClient.get(path, new FileSystemFile(destFile));

                files.add(destFile);
            }

            return new DownloadResult(files);
View Full Code Here

        ssh.loadKnownHosts();
        ssh.connect("localhost");
        try {
            ssh.authPublickey(System.getProperty("user.name"));
            final String src = System.getProperty("user.home") + File.separator + "test_file";
            final SFTPClient sftp = ssh.newSFTPClient();
            try {
                sftp.put(new FileSystemFile(src), "/tmp");
            } finally {
                sftp.close();
            }
        } finally {
            ssh.disconnect();
        }
    }
View Full Code Here

        final SSHClient ssh = new SSHClient();
        ssh.loadKnownHosts();
        ssh.connect("localhost");
        try {
            ssh.authPublickey(System.getProperty("user.name"));
            final SFTPClient sftp = ssh.newSFTPClient();
            try {
                sftp.get("test_file", new FileSystemFile("/tmp"));
            } finally {
                sftp.close();
            }
        } finally {
            ssh.disconnect();
        }
    }
View Full Code Here

TOP

Related Classes of net.schmizz.sshj.sftp.SFTPClient

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.