• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I read a file saved on a SFTP server using jScape's SFTP Api

 
Aniruddh Joshi
Ranch Hand
Posts: 275
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a scheduler in my application which periodically processes XML files saved on a FTP server. Recently my organisation has replaced the server with a SFTP server.
I have downloaded the API SFTP.zip and am trying to implement the following steps :
1) connect to the server
2) change the directory
3) read an XML file .

The first two steps are running without an excpetion, but I can't find a counterpart of

Quote:
byte[] result = ftp.get(fileName);

which I was using for normal FTP server.

My incomplete code follows :




Please let me know if such an implementation is possible .
If not, please suggest a way using which I can read XML files stored on SFTP server and after reading rename the file with a suffix '.PROCESSED'.

Thanks in advance

[ November 10, 2008: Message edited by: Aniruddh Joshi ]

[ November 10, 2008: Message edited by: Aniruddh Joshi ]
[ November 10, 2008: Message edited by: Aniruddh Joshi ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Googled quickly for this class, and I see methods named "download()", which generally place the downloaded data into a file for you, or "getInputStream()" which would allow you to read the data into an array (if that's what you wanted to do.) Did you look at the Javadoc?
 
Sivapraveen Chandana
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aniruddh,
Actually, I am not replying to your question.
The point is I too need to develop a tool that does similar kind of processing as you need to. Pleae tell where did you download the SFTP API from ?
And, where can I get all other related API like FTP, SSH etc.

Anybody who knows this, please reply....

Thanks..
 
Aniruddh Joshi
Ranch Hand
Posts: 275
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest,

I've tried dowmload() but its not what I want. Actually the javadoc which came with the download are incomplete.
I'll try to use getInputStream as it fitsd the requirement.

Siva,
You can download the API from jscape.com, A number of such API's are available but very few are free.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic