View Javadoc

1   /*
2    * Copyright 2001-2005 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.net.ftp;
17  import java.io.IOException;
18  import java.io.InputStream;
19  
20  /***
21   * FTPFileListParser defines the interface for parsing FTP file listings
22   * and converting that information into an array of
23   * {@link org.apache.commons.net.ftp.FTPFile} instances.
24   * Sometimes you will want to parse unusual listing formats, in which
25   * case you would create your own implementation of FTPFileListParser and
26   * if necessary, subclass FTPFile.
27   * <p>
28   * <p>
29   * @author Daniel F. Savarese
30   * @see FTPFile
31   * @see FTPClient#listFiles
32   * @deprecated This interface is deprecated as of version 1.2 and will be
33   * removed in version 2.0 -- use FTPFileEntryParser instead.
34   ***/
35  
36  public interface FTPFileListParser
37  {
38  
39      /***
40       * Parses an FTP server file listing and converts it into a usable format
41       * in the form of an array of <code> FTPFile </code> instances.  If the
42       * file list contains no files, <code> null </code> should be
43       * returned, otherwise an array of <code> FTPFile </code> instances
44       * representing the files in the directory is returned.
45       * <p>
46       * @param listStream The InputStream from which the file list should be
47       *        read.
48       * @param encoding The encoding to use.
49       * @return The list of file information contained in the given path.  null
50       *     if the list could not be obtained or if there are no files in
51       *     the directory.
52       * @exception IOException  If an I/O error occurs reading the listStream.
53       ***/
54      FTPFile[] parseFileList(InputStream listStream, String encoding) throws IOException;
55      
56      /***
57       * Parses an FTP server file listing and converts it into a usable format
58       * in the form of an array of <code> FTPFile </code> instances.  If the
59       * file list contains no files, <code> null </code> should be
60       * returned, otherwise an array of <code> FTPFile </code> instances
61       * representing the files in the directory is returned.
62       * <p>
63       * @param listStream The InputStream from which the file list should be
64       *        read.
65       * @return The list of file information contained in the given path.  null
66       *     if the list could not be obtained or if there are no files in
67       *     the directory.
68       * @exception IOException  If an I/O error occurs reading the listStream.
69       ***/
70      FTPFile[] parseFileList(InputStream listStream) throws IOException;
71  
72  }