org.apache.commons.net.ftp
Interface FTPFileEntryParser

All Known Implementing Classes:
FTPFileListParserImpl

public interface FTPFileEntryParser

FTPFileEntryParser defines the interface for parsing a single FTP file listing and converting that information into an FTPFile instance. Sometimes you will want to parse unusual listing formats, in which case you would create your own implementation of FTPFileEntryParser and if necessary, subclass FTPFile.

Version:
$Id: FTPFileEntryParser.java,v 1.4 2003/03/06 12:38:42 scohen Exp $
Author:
Steve Cohen
See Also:
FTPFile, FTPClient.createFileList(org.apache.commons.net.ftp.FTPFileEntryParser)

Method Summary
 FTPFile parseFTPEntry(java.lang.String listEntry)
          Parses a line of an FTP server file listing and converts it into a usable format in the form of an FTPFile instance.
 java.lang.String readNextEntry(java.io.BufferedReader reader)
          Reads the next entry using the supplied BufferedReader object up to whatever delemits one entry from the next.
 

Method Detail

parseFTPEntry

public FTPFile parseFTPEntry(java.lang.String listEntry)
Parses a line of an FTP server file listing and converts it into a usable format in the form of an FTPFile instance. If the file listing line doesn't describe a file, null should be returned, otherwise a FTPFile instance representing the files in the directory is returned.

Parameters:
listEntry - A line of text from the file listing
Returns:
An FTPFile instance corresponding to the supplied entry

readNextEntry

public java.lang.String readNextEntry(java.io.BufferedReader reader)
                               throws java.io.IOException
Reads the next entry using the supplied BufferedReader object up to whatever delemits one entry from the next. Implementors must define this for the particular ftp system being parsed. In many but not all cases, this can be defined simply by calling BufferedReader.readLine().

Parameters:
reader - The BufferedReader object from which entries are to be read.
Returns:
A string representing the next ftp entry or null if none found.
Throws:
java.io.IOException - thrown on any IO Error reading from the reader.