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