Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

setting File transfer mode in SFTP using JSch (jsch-20070302.jar)

807589Dec 10 2007 — edited Jan 16 2009
Hi,
I use Jsch for downloading and uploading files via SFTP. I am a facing a problem in the file transfer mode. When I download or upload manually the files seems file, but when I use my code to download or upload there is some problem. Actally the file has to be transferred in ASCII mode, but the code transfers it in binary mode. Below is the code I am using

+import com.jcraft.jsch.*
Session session = null;
try {
populateProperties();
log("INFO","Download and Encrypt Program started",getDateTime());
JSch jsch = new JSch();
String host = tumbleweedURL;
String user = tUserid;
session = jsch.getSession(user, host, 22);

session.setUserInfo(new MyUserInfo());
session.setPassword(tPassword);
session.connect();
Channel channel = session.openChannel("sftp");
channel.connect();
ChannelSftp c = (ChannelSftp) channel;
c.cd("outbox");
c.get("8",outFolderPath);
}+

Please tell me how I change the transfer mode to ASCII for the above code
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 13 2009
Added on Dec 10 2007
5 comments
2,133 views