Java FTP Component - FTP class, FTP library, FTP bean, FTP object, FTP client
Home Search Knowledge Base Support

Support

Click here for access to live sales support.

For technical support please submit a ticket to the Help Desk.

 

Java and .NET Help

iPod shuffle offer

For a limited time get the newly re-designed iPod shuffle free with qualifying purchase.

Click for details.


News

JSCAPE Secure FTP Server 7.0 Released
08/20/2010 03:31 AM

JSCAPE launches Employee Giving Program
07/03/2010 08:26 AM

SSH Factory 3.6 Released
07/03/2010 06:22 AM

Secure iNet Factory 8.5 Released
07/03/2010 06:07 AM

Secure FTP Factory 8.5 Released
07/03/2010 06:03 AM

Secure FTP Applet 6.2 Released
06/10/2010 02:23 PM

more...


Tutorials

Enabling Phone Authentication
04/08/2009 11:24 AM

Detecting and Handling Brute Force Password Attacks
01/29/2009 09:44 AM

Creating a Domain
12/15/2008 11:33 AM

Public key authentication with SFTP
10/02/2008 07:59 AM

Formatting MimeMessages using .NET
09/14/2008 04:31 PM

Communicating with an IMAP4 server in .NET
09/14/2008 03:54 PM

more...


Articles

Open up corporate data to your partners
08/03/2010 10:01 PM

Access vital corporate documents on the go
07/01/2010 02:15 PM

SFTP and Encryption
05/17/2010 09:52 PM

Streamlining web uploads with ZIP archives
12/14/2009 10:11 AM

Using regular expressions in complex trigger conditions
09/08/2009 07:42 AM

Using custom forms to automate business processes
07/03/2009 08:51 AM

more...


Feedback

Request a feature or component

Request a Java or .NET component


 

Java FTP component

This Java FTP component provides an easy to use API for the transfer of files to / from an FTP server. Written using 100% Java and delivered as a Java Bean, this Java FTP client is usable in a wide variety of IDE and platform configurations. Download Secure iNet Factory Evaluation

Other related JSCAPE products include:

Secure FTP Factory
JSCAPE Secure FTP Server
Secure FTP Applet

Features

  • Transfer mode support - Includes both ASCII and Binary modes for transferring text or binary data.
  • Firewall support - Easily connect to FTP servers from behind a firewall.
  • Security - Support for secure FTPS and SFTP protocols.
  • Automatic transfer mode detection - Sets transfer mode automatically based on file extension.
  • Multiple file transfer - Transfer one or more files matching a regular expression e.g. *.txt
  • Directory transfer - Transfer entire directories recursively, automatically recreating directory structure on receiving side.
  • Progress monitor - Built in event listeners to track the progress of file transfers including bytes transferred, total time and total bytes transferred.
  • Timeout support - Generates an exception when connection to FTP server cannot be established or data cannot be read from FTP server within defined timeout.
  • File transfer interruption - Ability to interrupt file transfers at any time.
  • Message logging - Ability to stream messages exchanged between FTP client and server to a file.
  • Memory based uploads - Ability to upload a file that exists in memory to FTP server.
  • Memory based downloads - Ability to download file from FTP server and store in memory.
  • Remote filesize and date - Easily query a remote file on FTP server for it's size and last modification timestamp.
  • Command execution - Send arbitrary commands to FTP server.
  • Append support - Upload files to FTP server appending data sent to the end of of a file.
  • Resume support - Resume interrupted file transfers.
  • File integrity - Verify the integrity of transferred files.

Code Example

The following example demonstrates how to connect to an FTP server and perform a directory listing.

/*
 * @(#)FtpExample.java
 *
 * Copyright (c) 2001-2002 JScape
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JScape. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JScape.
 */

import com.jscape.inet.ftp.*;
import java.io.*;
import java.util.Enumeration;

public class FtpExample extends FtpAdapter {
    private String hostname;
    private String username;
    private String password;
    
    public FtpExample(String hostname, String username, String password) {
        this.hostname = hostname;
        this.username = username;
        this.password = password;
    }
    
    // print out directory listing
    public void getListing() throws FtpException {
      
      // create new Ftp instance with hostname, username and password arguments
        Ftp ftp = new Ftp(hostname,username,password);
        
        // register this class to capture FTP related events
        ftp.addFtpListener(this);
        
        // connect to FTP server
        ftp.connect();
        
        // get results of a directory listing
        String results = ftp.getDirListingAsString();
        
        // print out directory listing results
        System.out.println(results);
        
        // disconnect from FTP server
        ftp.disconnect();
    }
    
    // captures connect event
    public void connected(FtpConnectedEvent evt) {
        System.out.println("Connected to server: " + evt.getHostname());
    }
    
    // captures disconnect event
    public void disconnected(FtpDisconnectedEvent evt) {
        System.out.println("Disconnected from server: " + evt.getHostname());
    }
    
    
    public static void main(String[] args) {
        String hostname;
        String username;
        String password;
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            System.out.print("Enter Ftp hostname (e.g. ftp.microsoft.com): ");
            hostname = reader.readLine();
            System.out.print("Enter username (e.g. anonymous): ");
            username = reader.readLine();
            System.out.print("Enter password (e.g. user@here.com): ");
            password = reader.readLine();
            FtpExample example = new FtpExample(hostname,username,password);
            example.getListing();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
}