本文整理汇总了Java中org.apache.commons.net.ftp.FTPFileFilters类的典型用法代码示例。如果您正苦于以下问题:Java FTPFileFilters类的具体用法?Java FTPFileFilters怎么用?Java FTPFileFilters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FTPFileFilters类属于org.apache.commons.net.ftp包,在下文中一共展示了FTPFileFilters类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: existFile
import org.apache.commons.net.ftp.FTPFileFilters; //导入依赖的package包/类
/**
*
* @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;
}
示例2: listDirectory
import org.apache.commons.net.ftp.FTPFileFilters; //导入依赖的package包/类
@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);
}
}
示例3: listDirectories
import org.apache.commons.net.ftp.FTPFileFilters; //导入依赖的package包/类
public FTPFile[] listDirectories(String parent) throws IOException {
return this.listFiles(parent, FTPFileFilters.DIRECTORIES);
}
示例4: getFiles
import org.apache.commons.net.ftp.FTPFileFilters; //导入依赖的package包/类
public FTPFile[] getFiles() throws IOException {
return this.getFiles(FTPFileFilters.NON_NULL);
}