Package org.apache.commons.net.ftp
Class FTPFileList
- java.lang.Object
-
- org.apache.commons.net.ftp.FTPFileList
-
public class FTPFileList extends java.lang.Object
Deprecated.This class is deprecated as of version 1.2 and will be removed in version 2.0 -- use FTPFileParseEngine instead.This class encapsulates a listing of files from an FTP server. It is initialized with an input stream which is read and the input split into lines, each of which (after some possible initial verbiage) represents a file on the FTP server. A parser is also supplied, which is used to iterate through the internal list of lines parsing each into an FTPFile object which is returned to the caller of the iteration methods. This parser may be replaced with another, allowing the same list to be parsed with different parsers. Parsing takes place on an as-needed basis, basically, the first time a position is iterated over. This happens at the time of iteration, not prior to it as the older(FTPClient.listFiles()
methods did, which required a bigger memory hit.- Version:
- $Id: FTPFileList.java 165675 2005-05-02 20:09:55Z rwinston $
- Author:
- Steve Cohen
- See Also:
FTPClient.createFileList(org.apache.commons.net.ftp.FTPFileEntryParser)
,FTPFileIterator
,FTPFileEntryParser
,FTPListParseEngine
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static FTPFileList
create(java.io.InputStream stream, FTPFileEntryParser parser)
Deprecated.The version of this method which takes an encoding should be used.static FTPFileList
create(java.io.InputStream stream, FTPFileEntryParser parser, java.lang.String encoding)
Deprecated.The only way to create anFTPFileList
object.FTPFile[]
getFiles()
Deprecated.returns an array of FTPFile objects for all the files in the directory listingFTPFileIterator
iterator()
Deprecated.create an iterator over this list using the parser with which this list was initally createdFTPFileIterator
iterator(FTPFileEntryParser parser)
Deprecated.create an iterator over this list using the supplied parservoid
readStream(java.io.InputStream stream)
Deprecated.The version of this method which takes an encoding should be used.void
readStream(java.io.InputStream stream, java.lang.String encoding)
Deprecated.internal method for reading the input into thelines
vector.
-
-
-
Method Detail
-
create
public static FTPFileList create(java.io.InputStream stream, FTPFileEntryParser parser, java.lang.String encoding) throws java.io.IOException
Deprecated.The only way to create anFTPFileList
object. Invokes the private constructor and then reads the stream supplied stream to build the intermediate array of "lines" which will later be parsed intoFTPFile
object.- Parameters:
stream
- The input stream created by reading the socket on which the output of the LIST command was returnedparser
- the defaultFTPFileEntryParser
to be used by this object. This may later be changed using the init() method.encoding
- The encoding to use- Returns:
- the
FTPFileList
created, with an initialized of unparsed lines of output. Will be null if the listing cannot be read from the stream. - Throws:
java.io.IOException
- Thrown on any failure to read from the socket.
-
create
public static FTPFileList create(java.io.InputStream stream, FTPFileEntryParser parser) throws java.io.IOException
Deprecated.The version of this method which takes an encoding should be used.The only way to create anFTPFileList
object. Invokes the private constructor and then reads the stream supplied stream to build the intermediate array of "lines" which will later be parsed intoFTPFile
object.- Parameters:
stream
- The input stream created by reading the socket on which the output of the LIST command was returnedparser
- the defaultFTPFileEntryParser
to be used by this object. This may later be changed using the init() method.- Returns:
- the
FTPFileList
created, with an initialized of unparsed lines of output. Will be null if the listing cannot be read from the stream. - Throws:
java.io.IOException
- Thrown on any failure to read from the socket.
-
readStream
public void readStream(java.io.InputStream stream, java.lang.String encoding) throws java.io.IOException
Deprecated.internal method for reading the input into thelines
vector.- Parameters:
stream
- The socket stream on which the input will be read.encoding
- The encoding to use.- Throws:
java.io.IOException
- thrown on any failure to read the stream
-
readStream
public void readStream(java.io.InputStream stream) throws java.io.IOException
Deprecated.The version of this method which takes an encoding should be used.internal method for reading the input into thelines
vector.- Parameters:
stream
- The socket stream on which the input will be read.- Throws:
java.io.IOException
- thrown on any failure to read the stream
-
iterator
public FTPFileIterator iterator()
Deprecated.create an iterator over this list using the parser with which this list was initally created- Returns:
- an iterator over this list using the list's default parser.
-
iterator
public FTPFileIterator iterator(FTPFileEntryParser parser)
Deprecated.create an iterator over this list using the supplied parser- Parameters:
parser
- The user-supplied parser with which the list is to be iterated, may be different from this list's default parser.- Returns:
- an iterator over this list using the supplied parser.
-
getFiles
public FTPFile[] getFiles()
Deprecated.returns an array of FTPFile objects for all the files in the directory listing- Returns:
- an array of FTPFile objects for all the files in the directory listinge
-
-