org.apache.commons.net.ftp
Class FTPFileIterator

java.lang.Object
  extended by org.apache.commons.net.ftp.FTPFileIterator

Deprecated. This class is deprecated as of version 1.2 and will be removed in version 2.0 - use FTPFileParseEngine instead

public class FTPFileIterator
extends Object

This class implements a bidirectional iterator over an FTPFileList. Elements may be retrieved one at at time using the hasNext() - next() syntax familiar from Java 2 collections. Alternatively, entries may be receieved as an array of any requested number of entries or all of them.

Version:
$Id: FTPFileIterator.java 165675 2005-05-02 20:09:55Z rwinston $
Author:
Steve Cohen
See Also:
FTPFileList, FTPFileEntryParser, FTPListParseEngine

Method Summary
 FTPFile[] getFiles()
          Deprecated. Returns a list of FTPFile objects for ALL files listed in the server's LIST output.
 FTPFile[] getNext(int quantityRequested)
          Deprecated. Returns an array of at most quantityRequested FTPFile objects starting at this iterator's current position within its associated list.
 FTPFile[] getPrevious(int quantityRequested)
          Deprecated. Returns an array of at most quantityRequested FTPFile objects starting at the position preceding this iterator's current position within its associated list.
 boolean hasNext()
          Deprecated. Method for determining whether getNext() will successfully return a non-null value.
 boolean hasPrevious()
          Deprecated. Method for determining whether getPrevious() will successfully return a non-null value.
 FTPFile next()
          Deprecated. Returns a single parsed FTPFile object corresponding to the raw input line at this iterator's current position.
 FTPFile previous()
          Deprecated. Returns a single parsed FTPFile object corresponding to the raw input line at the position preceding that of the internal iterator over the list of raw lines maintained by this object After this method is called the internal iterator is retreated by one element (unless it is already at beginning of list).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFiles

public FTPFile[] getFiles()
Deprecated. 
Returns a list of FTPFile objects for ALL files listed in the server's LIST output.

Returns:
a list of FTPFile objects for ALL files listed in the server's LIST output.

getNext

public FTPFile[] getNext(int quantityRequested)
Deprecated. 
Returns an array of at most quantityRequested FTPFile objects starting at this iterator's current position within its associated list. If fewer than quantityRequested such elements are available, the returned array will have a length equal to the number of entries at and after after the current position. If no such entries are found, this array will have a length of 0. After this method is called the current position is advanced by either quantityRequested or the number of entries available after the iterator, whichever is fewer.

Parameters:
quantityRequested - the maximum number of entries we want to get. A 0 passed here is a signal to get ALL the entries.
Returns:
an array of at most quantityRequested FTPFile objects starting at the current position of this iterator within its list and at least the number of elements which exist in the list at and after its current position.

hasNext

public boolean hasNext()
Deprecated. 
Method for determining whether getNext() will successfully return a non-null value.

Returns:
true if there exist any files after the one currently pointed to by the internal iterator, false otherwise.

next

public FTPFile next()
Deprecated. 
Returns a single parsed FTPFile object corresponding to the raw input line at this iterator's current position. After this method is called the internal iterator is advanced by one element (unless already at end of list).

Returns:
a single FTPFile object corresponding to the raw input line at the position of the internal iterator over the list of raw input lines maintained by this object or null if no such object exists.

getPrevious

public FTPFile[] getPrevious(int quantityRequested)
Deprecated. 
Returns an array of at most quantityRequested FTPFile objects starting at the position preceding this iterator's current position within its associated list. If fewer than quantityRequested such elements are available, the returned array will have a length equal to the number of entries after the iterator. If no such entries are found, this array will have a length of 0. The entries will be ordered in the same order as the list, not reversed. After this method is called the current position is moved back by either quantityRequested or the number of entries available before the current position, whichever is fewer.

Parameters:
quantityRequested - the maximum number of entries we want to get. A 0 passed here is a signal to get ALL the entries.
Returns:
an array of at most quantityRequested FTPFile objects starting at the position preceding the current position of this iterator within its list and at least the number of elements which exist in the list prior to its current position.

hasPrevious

public boolean hasPrevious()
Deprecated. 
Method for determining whether getPrevious() will successfully return a non-null value.

Returns:
true if there exist any files before the one currently pointed to by the internal iterator, false otherwise.

previous

public FTPFile previous()
Deprecated. 
Returns a single parsed FTPFile object corresponding to the raw input line at the position preceding that of the internal iterator over the list of raw lines maintained by this object After this method is called the internal iterator is retreated by one element (unless it is already at beginning of list).

Returns:
a single FTPFile object corresponding to the raw input line at the position immediately preceding that of the internal iterator over the list of raw input lines maintained by this object.


Copyright © 1997-2010 The Apache Software Foundation. All Rights Reserved.