FileDocCategorySizeDatePackage
FTPFileEntryParserImpl.javaAPI DocApache Commons NET 1.4.1 API4783Sat Dec 03 10:05:48 GMT 2005org.apache.commons.net.ftp

FTPFileEntryParserImpl

public abstract class FTPFileEntryParserImpl extends Object implements FTPFileListParser, FTPFileEntryParser
This abstract class implements both the older FTPFileListParser and newer FTPFileEntryParser interfaces with default functionality. All the classes in the parser subpackage inherit from this.

Fields Summary
Constructors Summary
public FTPFileEntryParserImpl()
The constructor for a FTPFileEntryParserImpl object.

    
Methods Summary
public FTPFile[]parseFileList(java.io.InputStream listStream, java.lang.String encoding)
Parses an FTP server file listing and converts it into a usable format in the form of an array of FTPFile instances. If the file list contains no files, null should be returned, otherwise an array of FTPFile instances representing the files in the directory is returned.

param
listStream The InputStream from which the file list should be read.
return
The list of file information contained in the given path. null if the list could not be obtained or if there are no files in the directory.
exception
java.io.IOException If an I/O error occurs reading the listStream.

        FTPFileList ffl = FTPFileList.create(listStream, this, encoding);
        return ffl.getFiles();

    
public FTPFile[]parseFileList(java.io.InputStream listStream)
Parses an FTP server file listing and converts it into a usable format in the form of an array of FTPFile instances. If the file list contains no files, null should be returned, otherwise an array of FTPFile instances representing the files in the directory is returned.

param
listStream The InputStream from which the file list should be read.
return
The list of file information contained in the given path. null if the list could not be obtained or if there are no files in the directory.
exception
java.io.IOException If an I/O error occurs reading the listStream.
deprecated
The version of this method which takes an encoding should be used.

    	return parseFileList(listStream, null);
    
public java.util.ListpreParse(java.util.List original)
This method is a hook for those implementors (such as VMSVersioningFTPEntryParser, and possibly others) which need to perform some action upon the FTPFileList after it has been created from the server stream, but before any clients see the list. This default implementation is a no-op.

param
original Original list after it has been created from the server stream
return
original unmodified.

         Iterator it = original.iterator();
         while (it.hasNext()){
            String entry = (String) it.next();
            if (null == parseFTPEntry(entry)) {
                it.remove();
            } else {
                break;
            }
         }
         return original;
     
public java.lang.StringreadNextEntry(java.io.BufferedReader reader)
Reads the next entry using the supplied BufferedReader object up to whatever delemits one entry from the next. This default implementation simply calls BufferedReader.readLine().

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

        return reader.readLine();