com.jcraft.jsch.SftpProgressMonitor Java Examples

The following examples show how to use com.jcraft.jsch.SftpProgressMonitor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JschFactory.java    From setupmaker with Apache License 2.0 6 votes vote down vote up
/**
 * Send a file to server path via SFTP
 * @param src
 * @param path
 * @throws SftpException
 */
public void put(final File src, String path) throws SftpException
{
    if (!path.endsWith("/")) path = path.concat("/");
    if (path.startsWith("/")) path = path.substring(1);
    
    ChannelSftp sftp = (ChannelSftp) channel;
    SftpProgressMonitor progress = new SftpProgressMonitor() {
        
        @Override public void init(int arg0, String arg1, String arg2, long arg3)
        {
            System.out.println("File transfer begin..");
        }
        
        @Override public void end()
        {
            Out.print(LOG_LEVEL.INFO, "Upload of file "+ src.getName() +" succeeded.");
            ready = true;
        }
        
        @Override public boolean count(long i) { return false; }
    };
    sftp.put(src.getAbsolutePath(), initRemDir+path+src.getName(), progress);
}
 
Example #2
Source File: SftpFileTransferProgressMonitor.java    From ats-framework with Apache License 2.0 5 votes vote down vote up
@Override
public void init(
                  int op,
                  String src,
                  String dest,
                  long max ) {

    String operation = (op == SftpProgressMonitor.PUT)
                                                       ? "UPLOAD"
                                                       : "DOWNLOAD";

    log.debug("Begin " + operation + " from " + this.source + " to " + this.destination);

}
 
Example #3
Source File: RdeModule.java    From nomulus with Apache License 2.0 4 votes vote down vote up
@Binds
abstract SftpProgressMonitor provideSftpProgressMonitor(
    LoggingSftpProgressMonitor loggingSftpProgressMonitor);