jitaftp

January 26th, 2009

JITAFTP it’s  a ftp library for java 1.6

The main features of this library it’s to use the ftp protocol in simple. Actually this project is stopped but the library work correctly and it have this features accomplished:

  • Login
  • Anonymous login
  • File upload
  • Directory upload
  • File download
  • Directory download
  • Delete files
  • Delete directory

You can visite the project page on SourceForge at: http://sourceforge.net/projects/jitaftp/ or you can visit project site at: http://jitaftp.sourceforge.net/

Example of using are inside of latest stable version of jitaftp.

A simple file download example is:

package examples;

import com.net.jitaftp.exception.FtpErrorException;
import com.net.jitaftp.exception.FtpException;
import com.net.jitaftp.ftp.FtpClient;
import java.util.Vector;

/**
 *
 * @author Walter Dal Mut
 */
public class DownloadFile
{

    public void goDownFile( )
    {

        try
        {
            //Server data
            FtpClient ftp = new FtpClient("127.0.0.1","walter@localhost","walter");

            //Connect to server
            ftp.connect();

            //Download list of file which are on server
            Vector<String> remoteFiles = ftp.list();

            //Download file or directory in thirt position.
            //ftp.download("filename.ext");
            ftp.download( remoteFiles.elementAt(3) );

            //Disconnect from server
            ftp.disconnect();
        }
        catch(FtpException ftpE)
        {
            ftpE.printStackTrace();
        }
        catch(FtpErrorException ftpE)//Using super-class for catching exception
        {
            ftpE.printStackTrace();
        }

    }

    public static void main(String[] args)
    {
        DownloadFile downloadFile = new DownloadFile();
        downloadFile.goDownFile();
    }
}
Comments are closed.