commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Lachman (JIRA)" <>
Subject [jira] Created: (NET-244) Add a FTPClient.listFiles(FTPFileFilter) method
Date Tue, 18 Nov 2008 15:55:44 GMT
Add a FTPClient.listFiles(FTPFileFilter) method

                 Key: NET-244
             Project: Commons Net
          Issue Type: New Feature
    Affects Versions: 2.0
            Reporter: Matt Lachman
            Priority: Minor

It would be nice if there was a way to list *only* those files I'm interested in.  I've had
to write a loop a couple of times to figure out which files had the right naming conventions.
 If the API handled that for me, I would have less boilerplate code to write.

I would attach a patch but as of this time I cannot download the source due to an internal
server error.

I was imagining the introduction of a new interface {{}}
that would be analogous to [|]:

public interface FTPFileFilter {
   public boolean accept(FTPFile file);

A new method on FTPClient would need to be created to support it.  Here's a code sample using
API calls:
public FTPFile[] listFiles(FTPFileFilter filter) throws IOException {
   FTPFile files = listFIles();
   List<FTPFile> fileList = new ArrayList<FTPFile>(files.length);
   for (FTPFile file : files) {
      if (filter.accept(file)) {
   return fileList.toArray(new FTPFile[fileList.size()]);

See [|]
for comparison.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message