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

项目:filesystem    文件:FTPClient.java   
/**
 * List files in the specified directory, apply a filter then pass each one to a consumer
 * <p>
 * @param pathname directory name
 * @param filter   filter
 * @param c        Consumer
 * <p>
 * @throws IOException
 */
default void forEach( String pathname, FTPFileFilter filter, IOConsumer<FTPFile> c )
        throws IOException
{
    try {
        forEachFile( pathname, filter, c.guard() );
    }
    catch( UncheckedIOException ex ) {
        throw ex.getCause();
    }
}
项目:filesystem    文件:FTPClient.java   
default void forEachMlist( String pathname, FTPFileFilter filter, IOConsumer<FTPFile> c )
        throws IOException
{
    try {
        forEachMlistDir( pathname, filter, c.guard() );
    }
    catch( UncheckedIOException ex ) {
        throw ex.getCause();
    }
}
项目:opendata-common    文件:FTPClient.java   
/**
 * List files in the specified directory, apply a filter then pass each one to a consumer
 * <p>
 * @param pathname directory name
 * @param filter   filter
 * @param c        Consumer
 * <p>
 * @throws IOException
 */
default void forEach( String pathname, FTPFileFilter filter, IOConsumer<FTPFile> c )
        throws IOException
{
    try {
        forEachFile( pathname, filter, c.guard() );
    }
    catch( UncheckedIOException ex ) {
        throw ex.getCause();
    }
}
项目:opendata-common    文件:FTPClient.java   
default void forEachMlist( String pathname, FTPFileFilter filter, IOConsumer<FTPFile> c )
        throws IOException
{
    try {
        forEachMlistDir( pathname, filter, c.guard() );
    }
    catch( UncheckedIOException ex ) {
        throw ex.getCause();
    }
}
项目:xdm    文件:FTPListParseEngine.java   
public FTPFile[] getFiles(FTPFileFilter filter) throws IOException {
   ArrayList tmpResults = new ArrayList();
   Iterator iter = this.entries.iterator();

   while(iter.hasNext()) {
      String entry = (String)iter.next();
      FTPFile temp = this.parser.parseFTPEntry(entry);
      if(filter.accept(temp)) {
         tmpResults.add(temp);
      }
   }

   return (FTPFile[])tmpResults.toArray(new FTPFile[tmpResults.size()]);
}
项目:openyu-commons    文件:FtpClientTemplateImpl.java   
public FTPFile[] listFiles(final String pathname, final FTPFileFilter filter) throws IOException {
    if (pathname == null || filter == null) {
        return null;
    }
    //
    return execute(new FtpClientCallback<FTPFile[]>() {
        public FTPFile[] doInAction(FtpClientSession session) throws FtpClientTemplateException {
            try {
                return session.listFiles(pathname, filter);
            } catch (Exception ex) {
                throw new FtpClientTemplateException(ex);
            }
        }
    });
}
项目:openyu-commons    文件:CommonFtoSupporter.java   
public FTPFile[] listFiles(String pathname, FTPFileFilter filter) {
    try {
        return ftpClientTemplate.listFiles(pathname, filter);
    } catch (Exception ex) {
        throw new CommonFtoException(ex);
    }
}
项目:filesystem    文件:DefaultFTPClient.java   
@Override
public Collection<FTPFile> mlistDir( String pathname, FTPFileFilter filter )
        throws IOException
{
    return Arrays.asList( ftp.mlistDir( pathname, filter ) );
}
项目:filesystem    文件:DefaultFTPClient.java   
@Override
public Collection<FTPFile> listFiles( String pathname, FTPFileFilter filter )
        throws IOException
{
    return Arrays.asList( ftp.listFiles( pathname, filter ) );
}
项目:filesystem    文件:FTPClient.java   
default Stream<FTPFile> files( String pathname, FTPFileFilter filter )
        throws IOException
{
    return listFiles( pathname, filter ).stream();
}
项目:filesystem    文件:FTPClient.java   
default Stream<FTPFile> files( FTPFileFilter filter )
        throws IOException
{
    return listFiles( filter ).stream();
}
项目:filesystem    文件:FTPClient.java   
Collection<FTPFile> mlistDir( String pathname, FTPFileFilter filter )
throws IOException;
项目:filesystem    文件:FTPClient.java   
default void forEachMlistDir( String pathname, FTPFileFilter filter, Consumer<FTPFile> c )
        throws IOException
{
    CollectionUtils.forEach( mlistDir( pathname, filter ), c );
}
项目:opendata-common    文件:DefaultFTPClient.java   
@Override
public Collection<FTPFile> mlistDir( String pathname, FTPFileFilter filter )
        throws IOException
{
    return Arrays.asList( ftp.mlistDir( pathname, filter ) );
}
项目:opendata-common    文件:DefaultFTPClient.java   
@Override
public Collection<FTPFile> listFiles( String pathname, FTPFileFilter filter )
        throws IOException
{
    return Arrays.asList( ftp.listFiles( pathname, filter ) );
}
项目:opendata-common    文件:LazyFTPClient.java   
@Override
public Collection<FTPFile> listFiles( String pathname, FTPFileFilter filter )
        throws IOException
{
    return getClient().listFiles( pathname, filter );
}
项目:opendata-common    文件:LazyFTPClient.java   
@Override
public Stream<FTPFile> files( String pathname, FTPFileFilter filter )
        throws IOException
{
    return getClient().files( pathname, filter );
}
项目:opendata-common    文件:LazyFTPClient.java   
@Override
public Collection<FTPFile> listFiles( FTPFileFilter filter )
        throws IOException
{
    return getClient().listFiles( filter );
}
项目:opendata-common    文件:LazyFTPClient.java   
@Override
public Stream<FTPFile> files( FTPFileFilter filter )
        throws IOException
{
    return getClient().files( filter );
}
项目:opendata-common    文件:LazyFTPClient.java   
@Override
public void forEachFile( String pathname, FTPFileFilter filter, Consumer<FTPFile> c )
        throws IOException
{
    getClient().forEachFile( pathname, filter, c );
}
项目:opendata-common    文件:LazyFTPClient.java   
@Override
public void forEach( FTPFileFilter filter, IOConsumer<FTPFile> c )
        throws IOException
{
    getClient().forEach( filter, c );
}
项目:opendata-common    文件:LazyFTPClient.java   
@Override
public void forEach( String pathname, FTPFileFilter filter, IOConsumer<FTPFile> c )
        throws IOException
{
    getClient().forEach( pathname, filter, c );
}
项目:opendata-common    文件:LazyFTPClient.java   
@Override
public Collection<FTPFile> mlistDir( String pathname, FTPFileFilter filter )
        throws IOException
{
    return getClient().mlistDir( pathname, filter );
}
项目:opendata-common    文件:LazyFTPClient.java   
@Override
public void forEachMlistDir( String pathname, FTPFileFilter filter, Consumer<FTPFile> c )
        throws IOException
{
    getClient().forEachMlistDir( pathname, filter, c );
}
项目:opendata-common    文件:LazyFTPClient.java   
@Override
public void forEachMlist( String pathname, FTPFileFilter filter, IOConsumer<FTPFile> c )
        throws IOException
{
    getClient().forEachMlist( pathname, filter, c );
}
项目:opendata-common    文件:FTPClient.java   
default Stream<FTPFile> files( String pathname, FTPFileFilter filter )
        throws IOException
{
    return listFiles( pathname, filter ).stream();
}
项目:opendata-common    文件:FTPClient.java   
default Stream<FTPFile> files( FTPFileFilter filter )
        throws IOException
{
    return listFiles( filter ).stream();
}
项目:opendata-common    文件:FTPClient.java   
Collection<FTPFile> mlistDir( String pathname, FTPFileFilter filter )
throws IOException;
项目:opendata-common    文件:FTPClient.java   
default void forEachMlistDir( String pathname, FTPFileFilter filter, Consumer<FTPFile> c )
        throws IOException
{
    CollectionUtils.forEach( mlistDir( pathname, filter ), c );
}
项目:xdm    文件:FTPClient.java   
public FTPFile[] mlistDir(String pathname, FTPFileFilter filter) throws IOException {
   FTPListParseEngine engine = this.initiateMListParsing(pathname);
   return engine.getFiles(filter);
}
项目:xdm    文件:FTPClient.java   
public FTPFile[] listFiles(String pathname, FTPFileFilter filter) throws IOException {
   FTPListParseEngine engine = this.initiateListParsing((String)null, pathname);
   return engine.getFiles(filter);
}
项目:openyu-commons    文件:FtpClientSessionImpl.java   
public FTPFile[] mlistDir(String pathname, FTPFileFilter filter) throws IOException {
    return delegate.mlistDir(pathname, filter);
}
项目:openyu-commons    文件:FtpClientSessionImpl.java   
public FTPFile[] listFiles(String pathname, FTPFileFilter filter) throws IOException {
    return delegate.listFiles(pathname, filter);
}
项目:openyu-commons    文件:PoolableFtpClient.java   
public FTPFile[] mlistDir(String pathname, FTPFileFilter filter) throws IOException {
    return this.delegate.mlistDir(pathname, filter);
}
项目:openyu-commons    文件:PoolableFtpClient.java   
public FTPFile[] listFiles(String pathname, FTPFileFilter filter) throws IOException {
    checkOpen();
    return this.delegate.listFiles(pathname, filter);
}
项目:openyu-commons    文件:FtpClientFto.java   
FTPFile[] listFiles(String pathname, FTPFileFilter filter)
throws IOException;
项目:spring-boot    文件:FtpConnection.java   
/**
 * 列出指定路径中的文件和文件夹信息(可以是单独的一个文件 ),因为 org.apache.commons.net.ftp.FTPFile 中没有文件路径信息,故重新包装为自定义的 FTPFile 类
 *
 * @param remotePath
 * @param ftpFileFilter 过滤器
 * @return
 * @throws FtpException
 */
@Override
public List<JFTPFile> listFiles(String remotePath, FTPFileFilter ftpFileFilter) throws FtpException {
    List<JFTPFile> files = new ArrayList<JFTPFile>();

    try {

        String originalWorkingDirectory = getWorkingDirectory();

        if (existsDirectory(remotePath))
            changeDirectory(remotePath);
        else throw new FtpException(String.format(NO_SUCH_DIRECTORY_MESSAGE, remotePath));

        String newWorkingDirectory = getWorkingDirectory();

        FTPFile[] ftpFiles;


        if (ftpFileFilter == null)
            ftpFiles = client.listFiles(newWorkingDirectory);
        else
            ftpFiles = client.listFiles(newWorkingDirectory, ftpFileFilter);

        for (FTPFile file : ftpFiles)
            files.add(toFtpFile(file, newWorkingDirectory));

        //恢复 ftpClient 当前工作目录属性
        changeDirectory(originalWorkingDirectory);

    } catch (IOException e) {

        throw new FtpException(String.format(FILE_LISTING_ERROR_MESSAGE, remotePath), e);
    }

    return files;
}
项目:filesystem    文件:FTPClient.java   
/**
 * List all files in a directory
 * <p>
 * @param pathname directory name
 * @param filter   Filter to use
 * <p>
 * @return collection of entries
 * <p>
 * @throws IOException
 */
Collection<FTPFile> listFiles( String pathname, FTPFileFilter filter )
        throws IOException;
项目:filesystem    文件:FTPClient.java   
/**
 * List all files in a directory
 * <p>
 * @param filter Filter to use
 * <p>
 * @return collection of entries
 * <p>
 * @throws IOException
 */
default Collection<FTPFile> listFiles( FTPFileFilter filter )
        throws IOException
{
    return listFiles( null, filter );
}
项目:filesystem    文件:FTPClient.java   
/**
 * List files in the specified directory, apply a filter then pass each one to a consumer
 * <p>
 * @param pathname directory name
 * @param filter   filter
 * @param c        Consumer
 * <p>
 * @throws IOException
 */
default void forEachFile( String pathname, FTPFileFilter filter, Consumer<FTPFile> c )
        throws IOException
{
    CollectionUtils.forEach( listFiles( pathname, filter ), c );
}