Java 类org.apache.commons.net.ftp.FTPFileFilters 实例源码

项目:nyla    文件:ApacheFtp.java   
/**
 * 
 * @param path the file PATH
 * @return true if the file exist
 */
public boolean existFile(String directory,String fileRegExp)
throws IOException
{


    if(!connected)
        this.connect();

    FTPFile[] files = this.ftpClient.listFiles(directory,FTPFileFilters.ALL);

    if(files == null || files.length == 0)
        return false;


    for (int i = 0; i < files.length; i++)
    {
        if(!files[i].isFile())
            continue;

        if(files[i].getName().matches(fileRegExp))
            return true;
    }

    return false;
}
项目:Xenon    文件:FtpFileSystem.java   
@Override
protected List<PathAttributes> listDirectory(Path path) throws XenonException {
    assertIsOpen();
    assertDirectoryExists(path);

    try {
        ArrayList<PathAttributes> result = new ArrayList<>();

        for (FTPFile f : ftpClient.listFiles(path.toString(), FTPFileFilters.NON_NULL)) {
            result.add(convertAttributes(path.resolve(f.getName()), f));
        }

        return result;
    } catch (IOException e) {
        throw new XenonException(ADAPTOR_NAME, "Failed to retrieve directory listing of " + path, e);
    }
}
项目:xdm    文件:FTPClient.java   
public FTPFile[] listDirectories(String parent) throws IOException {
   return this.listFiles(parent, FTPFileFilters.DIRECTORIES);
}
项目:xdm    文件:FTPListParseEngine.java   
public FTPFile[] getFiles() throws IOException {
   return this.getFiles(FTPFileFilters.NON_NULL);
}