tags:

views:

329

answers:

1

I am creating an application for the android, and would like it to be able to read a text file via anonymous FTP. I've tried URLConnection, but it doesn't seam to be working. After some Google searching it appears that URLConnection doesn't always work with some FTP servers. All of the java FTP connection libraries I've found require you to download the file to a local location before reading it. However I would like to have the same functionality as URLConnection in that I can just use the following similar code:

String urlString = "ftp://ftp.domain.com/testing.txt";
URL url = new URL(urlString);
FTPConnection conn = url.openConnection();

BufferedReader reader = new BufferedReader(new InputStreamReader(
                conn.getInputStream()));

Thank you in advance,

John

+2  A: 

This comprehensive article compares available Java FTP libraries, explains the two RFCs and their implementations in the SUN JDK and has a lot of more links:

Java FTP client libraries reviewed

And there was a recommendation for Zehon, that seems to be able to download a file to an input stream. Hope it works with android as well.

Andreas_D
Thanks, this is exactly what I needed.
postalservice14