This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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

 
Ranch Hand
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic