当前位置: 首页>>代码示例>>Java>>正文


Java DirectoryFileFilter.DIRECTORY属性代码示例

本文整理汇总了Java中org.apache.commons.io.filefilter.DirectoryFileFilter.DIRECTORY属性的典型用法代码示例。如果您正苦于以下问题:Java DirectoryFileFilter.DIRECTORY属性的具体用法?Java DirectoryFileFilter.DIRECTORY怎么用?Java DirectoryFileFilter.DIRECTORY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.io.filefilter.DirectoryFileFilter的用法示例。


在下文中一共展示了DirectoryFileFilter.DIRECTORY属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listFilesOrDirectories

/**
    * get the list of files or directories in a directory
    * 
    * @param pathname
    *            the directory pathname to list
    * @param type
    *            the type of File list to return: LIST_FILES_ONLY or
    *            LIST_DIRECTORIES_ONLY
    * @return the files or directories list
    * 
    * @throws InvalidLoginException
    */
   private List<String> listFilesOrDirectories(String pathname, int type)
    throws InvalidLoginException {

pathname = PathUtil.rewriteToUnixSyntax(pathname);

RemoteFile theRemoteFile = new RemoteFile(remoteSession, pathname);

FileFilter fileFilter = null;

if (type == LIST_FILES_ONLY) {
    fileFilter = FileFileFilter.FILE;
} else if (type == LIST_DIRECTORIES_ONLY) {
    fileFilter = DirectoryFileFilter.DIRECTORY;
} else {
    throw new IllegalArgumentException(
	    Tag.PRODUCT_PRODUCT_FAIL
		    + " Invalid type. Msust be LIST_FILES_ONLY or LIST_DIRECTORIES_ONLY. Is: "
		    + type);
}

RemoteFile[] remoteFiles = theRemoteFile.listFiles(fileFilter);

if (remoteFiles == null) {
    return null;
}

List<String> filenameList = new ArrayList<String>();
for (RemoteFile remoteFileItem : remoteFiles) {
    filenameList.add(remoteFileItem.getName());
}

return filenameList;
   }
 
开发者ID:kawansoft,项目名称:awake-file,代码行数:45,代码来源:FileSession.java

示例2: loadSetFromDirectory

private void loadSetFromDirectory(File directory, Set<String> sessionIds, int depth)
{
  if (depth < MAX_DPETH)
  {
    FileFilter filter = (FileFilter) DirectoryFileFilter.DIRECTORY;

    File[] subdirectories = directory.listFiles(filter);

    for (File subdirectory : subdirectories)
    {
      this.loadSetFromDirectory(subdirectory, sessionIds, ( depth + 1 ));
    }
  }
  else
  {
    File[] sessions = directory.listFiles();

    for (File session : sessions)
    {
      if (session.isFile())
      {
        String sessionId = session.getName();

        sessionIds.add(sessionId);
      }
      else
      {
        throw new ProgrammingErrorException("Expecting only session");
      }
    }
  }
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:32,代码来源:FileSessionCache.java

示例3: SubDirectoryWalker

public SubDirectoryWalker(List<KeyValue> keyValues) {
    super(DirectoryFileFilter.DIRECTORY, -1);
    this.keyValues = keyValues;
    this.recursiveDepth = 0;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:5,代码来源:MarcFileUploadFileDirectoryPathValuesFinder.java


注:本文中的org.apache.commons.io.filefilter.DirectoryFileFilter.DIRECTORY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。