001    /*
002     * Copyright 2001-2005 The Apache Software Foundation
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.apache.commons.net.ftp;
017    import java.io.IOException;
018    import java.io.InputStream;
019    
020    /***
021     * FTPFileListParser defines the interface for parsing FTP file listings
022     * and converting that information into an array of
023     * {@link org.apache.commons.net.ftp.FTPFile} instances.
024     * Sometimes you will want to parse unusual listing formats, in which
025     * case you would create your own implementation of FTPFileListParser and
026     * if necessary, subclass FTPFile.
027     * <p>
028     * <p>
029     * @author Daniel F. Savarese
030     * @see FTPFile
031     * @see FTPClient#listFiles
032     * @deprecated This interface is deprecated as of version 1.2 and will be
033     * removed in version 2.0 -- use FTPFileEntryParser instead.
034     ***/
035    
036    public interface FTPFileListParser
037    {
038    
039        /***
040         * Parses an FTP server file listing and converts it into a usable format
041         * in the form of an array of <code> FTPFile </code> instances.  If the
042         * file list contains no files, <code> null </code> should be
043         * returned, otherwise an array of <code> FTPFile </code> instances
044         * representing the files in the directory is returned.
045         * <p>
046         * @param listStream The InputStream from which the file list should be
047         *        read.
048         * @param encoding The encoding to use.
049         * @return The list of file information contained in the given path.  null
050         *     if the list could not be obtained or if there are no files in
051         *     the directory.
052         * @exception IOException  If an I/O error occurs reading the listStream.
053         ***/
054        FTPFile[] parseFileList(InputStream listStream, String encoding) throws IOException;
055        
056        /***
057         * Parses an FTP server file listing and converts it into a usable format
058         * in the form of an array of <code> FTPFile </code> instances.  If the
059         * file list contains no files, <code> null </code> should be
060         * returned, otherwise an array of <code> FTPFile </code> instances
061         * representing the files in the directory is returned.
062         * <p>
063         * @param listStream The InputStream from which the file list should be
064         *        read.
065         * @return The list of file information contained in the given path.  null
066         *     if the list could not be obtained or if there are no files in
067         *     the directory.
068         * @exception IOException  If an I/O error occurs reading the listStream.
069         ***/
070        FTPFile[] parseFileList(InputStream listStream) throws IOException;
071    
072    }