SunQuest
           FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 31st, 2004, 08:24 AM
dave2k's Avatar
dave2k dave2k is offline
Banned
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2003
Location: GB
Posts: 553 dave2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 sec
Reputation Power: 0
ftp

how can i incoroporate ftp functions into my java code?

I tried searching at sun but found nothing

i would use the basic functions rather then using a set of functions someone else has developed

cheers

Reply With Quote
  #2  
Old March 31st, 2004, 11:55 AM
rossM rossM is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: England
Posts: 952 rossM User rank is Corporal (100 - 500 Reputation Level)rossM User rank is Corporal (100 - 500 Reputation Level)rossM User rank is Corporal (100 - 500 Reputation Level)rossM User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 38 m 44 sec
Reputation Power: 8
What kind of functions do you want? Downloading a file from an ftp server isn't too complicated.

First create a URL object and give the protocol, host and a filename (you could use a different constructor if you wish):
URL url = new URL("ftp", "ftp.foo.com", "/pub/file.txt");

Now you can connect to the server:
URLConnection conn = url.openConnection();
conn.connect();


To read data from the file, get an input stream:
InputStream in = conn.getInputStream();

This next bit will print the contents to standard output (only good if it's a plain text file):
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}

Reply With Quote
  #3  
Old April 1st, 2004, 08:41 AM
e4c5 e4c5 is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Posts: 778 e4c5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 23 m 20 sec
Reputation Power: 5
As ross has pointed out downloading from an FTP server isn't difficult at all. Same goes for uploading. Unfortunately if you want more than that you need to find an FTP library there are several available (shameless plug: including our own free library).
__________________
A lean and mean secure FTP applet with GUI. Just 150 kb in size
http://www.radinks.com/sftp

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > ftp


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway