Example usage for org.apache.commons.net.ssh SSHClient useCompression

List of usage examples for org.apache.commons.net.ssh SSHClient useCompression

Introduction

In this page you can find the example usage for org.apache.commons.net.ssh SSHClient useCompression.

Prototype

@SuppressWarnings("unchecked")
public void useCompression() throws TransportException 

Source Link

Document

Adds zlib compression to preferred compression algorithms.

Usage

From source file:examples.ssh.SCPUpload.java

public static void main(String[] args) throws Exception {
    SSHClient ssh = new SSHClient();
    ssh.loadKnownHosts();/*from  ww  w .  j av  a  2  s.  c  o m*/
    ssh.connect("localhost");
    try {
        ssh.authPublickey(System.getProperty("user.name"));

        // Compression = significant speedup for large file transfers on fast links
        // present here to demo algorithm renegotiation - could have just put this before connect()
        ssh.useCompression();

        ssh.newSCPFileTransfer().upload("/Users/shikhar/well", "/tmp/");
    } finally {
        ssh.disconnect();
    }
}