File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes ftp question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "ftp question" Watch "ftp question" New topic

ftp question

Raj Bhandari
Ranch Hand

Joined: Oct 19, 2005
Posts: 97
Hi everyone,

I have this ques, please help:

I wrote the a program using jdom to create an xml file which works fine. Following are the main steps:

Now, I need to have this application on the web and do a ftp of the file. I do not want to have the new xml files be first put on the originating server or some network file server and then ftp'ed to the destination.

Is there a good way to create the xml file in memory and then do an ftp ?

I'm new to java, so looking at the jdom api, i think this can be used:

and in apache commons net api for the ftp part, I can see this:

Basically I don't know how to add these things up and get something that just goes from doc -> outputstream/inputstream -> ftp.
I don't want to have a copy of all files on my end.

Any hints or suggestions ?
Thanks a lot!

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
How about

void output(Document doc, storeFileStream(String remote));

I think the javadocs of the storeFileStream method are confusing about that the file has to exist on the server. Give it a try and let us know how you make out.
Raj Bhandari
Ranch Hand

Joined: Oct 19, 2005
Posts: 97
Hi Ulf (and everyone),

I did try the following and it works:

Hope this helps someone.

I agree. Here's the link:
subject: ftp question
It's not a secret anymore!