Sftptool.java 1

Source: Internet
Author: User

Two tool class-dependent jar packages:

Ftptool.java
 Public Static voidMain (string[] args)throwsexception{Ftptool Ftptool=NewFtptool (); FtpClient ftpclient=NULL; InputStream Stream=NULL; Stream=streamtool.getstreamfromstring (STREAMTOOL.STREAMSTR); Try{String host= "10.16.55.21";//IP            intPort = 21;//PortString username = "Zssys";//UserString password = "Zssys";//Passwordftpclient= Ftptool.createftpclient (host, port, username, password,NULL,NULL); Ftptool.mkdir ("/home/zstest/dvlp/pic_test/underwrt_pic/test/", "123/456/789", ftpclient);//Build CatalogFtptool.upload ("/home/zstest/dvlp/pic_test/underwrt_pic/test/", "d:/temp/", "Housingestatemanagerment.rar", FtpClient);//UploadFtptool.upload ("/home/zstest/dvlp/pic_test/underwrt_pic/test/", Stream, "ddd.") PNG ", ftpclient);//UploadFtptool.download ("/home/zstest/dvlp/pic_test/underwrt_pic/test/", "ddd.") PNG "," d:/temp/haha/"," Download. " PNG ", ftpclient);//DownloadFtptool.delete ("/home/zstest/dvlp/pic_test/underwrt_pic/test/", "Delete.txt", ftpclient);//Delete}Catch(Exception e) {e.printstacktrace (); }finally{ftptool.disconnect (ftpclient); }    }

Sftptool.java
 Public Static voidMain (string[] args)throwsexception{Sftptool Sftool=NewSftptool (); Session Session=NULL; CHANNELSFTP Channel=NULL; InputStream Stream=NULL; Stream=streamtool.getstreamfromstring (STREAMTOOL.STREAMSTR); Try{String host= "10.15.22.120";//IP            intPort = 22;//PortString username = "WebLogic";//UserString password = "WebLogic";//PasswordSession =sftool.getsession (host, port, username, password); Channel=Sftool.getconnect (session); Sftool.mkdir ("/data/temp/test/", "123/888/789", channel);//Build CatalogSftool.upload ("/data/temp/test/", "d:/temp/", "Housingestatemanagerment.rar", channel);//UploadSftool.upload ("/data/temp/test/", Stream, "ddd.") PNG ", channel);//UploadSftool.download ("/data/temp/test/", "Download.txt", "d:/temp/haha/", "Download.txt", channel);//DownloadSftool.delete ("/data/temp/test/", "Delete.txt", channel);//Delete}Catch(Exception e) {e.printstacktrace (); }finally{sftool.disconnect (channel,session); }    }

Sftptool.java 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.