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


Java VirtualFile.list方法代码示例

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


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

示例1: scan

import play.vfs.VirtualFile; //导入方法依赖的package包/类
private static void scan(List<Template> templates, VirtualFile current) {
    if (!current.isDirectory() && !current.getName().startsWith(".") && !current.getName().endsWith(".scala.html")) {
        long start = System.currentTimeMillis();
        Template template = load(current);
        if (template != null) {
            try {
                template.compile();
                if (Logger.isTraceEnabled()) {
                    Logger.trace("%sms to load %s", System.currentTimeMillis() - start, current.getName());
                }
            } catch (TemplateCompilationException e) {
                Logger.error("Template %s does not compile at line %d", e.getTemplate().name, e.getLineNumber());
                throw e;
            }
            templates.add(template);
        }
    } else if (current.isDirectory() && !current.getName().startsWith(".")) {
        for (VirtualFile virtualFile : current.list()) {
            scan(templates, virtualFile);
        }
    }
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:23,代码来源:TemplateLoader.java

示例2: getAllClasses

import play.vfs.VirtualFile; //导入方法依赖的package包/类
List<ApplicationClass> getAllClasses(VirtualFile path, String basePackage) {
    if (basePackage.length() > 0 && !basePackage.endsWith(".")) {
        basePackage += ".";
    }
    List<ApplicationClass> res = new ArrayList<ApplicationClass>();
    for (VirtualFile virtualFile : path.list()) {
        scan(res, basePackage, virtualFile);
    }
    return res;
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:11,代码来源:ApplicationClassloader.java

示例3: scan

import play.vfs.VirtualFile; //导入方法依赖的package包/类
void scan(List<ApplicationClass> classes, String packageName, VirtualFile current) {
    if (!current.isDirectory()) {
        if (current.getName().endsWith(".java") && !current.getName().startsWith(".")) {
            String classname = packageName + current.getName().substring(0, current.getName().length() - 5);
            classes.add(Play.classes.getApplicationClass(classname));
        }
    } else {
        for (VirtualFile virtualFile : current.list()) {
            scan(classes, packageName + current.getName() + ".", virtualFile);
        }
    }
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:13,代码来源:ApplicationClassloader.java

示例4: scanPrecompiled

import play.vfs.VirtualFile; //导入方法依赖的package包/类
void scanPrecompiled(List<ApplicationClass> classes, String packageName, VirtualFile current) {
    if (!current.isDirectory()) {
        if (current.getName().endsWith(".class") && !current.getName().startsWith(".")) {
            String classname = packageName.substring(5) + current.getName().substring(0, current.getName().length() - 6);
            classes.add(new ApplicationClass(classname));
        }
    } else {
        for (VirtualFile virtualFile : current.list()) {
            scanPrecompiled(classes, packageName + current.getName() + ".", virtualFile);
        }
    }
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:13,代码来源:ApplicationClassloader.java

示例5: scan

import play.vfs.VirtualFile; //导入方法依赖的package包/类
private void scan(StringBuffer buf, VirtualFile current) {
    if (!current.isDirectory()) {
        if (current.getName().endsWith(".java")) {
            buf.append( getClassDefsForFile(current));
        }
    } else if (!current.getName().startsWith(".")) {
        // TODO: we could later optimizie it further if we check if the entire folder is unchanged
        for (VirtualFile virtualFile : current.list()) {
            scan(buf, virtualFile);
        }
    }
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:13,代码来源:ClassStateHashCreator.java

示例6: getFileNamesInFolder

import play.vfs.VirtualFile; //导入方法依赖的package包/类
/**
 * This will display all files except for empty.txt refined 20130918
 * 
 * @param folderName
 * @return
 */
public static List<String> getFileNamesInFolder(String folderName) {

	List<String> fileNameList = new ArrayList<String>();

	try {

		VirtualFile virtualDir = VirtualFile.fromRelativePath(folderName);
		List<VirtualFile> virtualFileList = virtualDir.list();

		if (virtualFileList == null) {
			 models.utils.LogUtils.printLogError
					 ("virtualFileList is NULL! in getFileNamesInFolder()"
							+ DateUtils.getNowDateTimeStrSdsm());
		}

		models.utils.LogUtils.printLogNormal("Under folder: " + folderName
				+ ",  File/dir count is " + virtualFileList.size());

		for (int i = 0; i < virtualFileList.size(); i++) {

			if (virtualFileList.get(i).getRealFile().isFile()) {
				String fileName = virtualFileList.get(i).getName();

				if ((!fileName
						.equalsIgnoreCase(VarUtils.FILE_NAME_APP_LOG_EMPTY))) {

					if (VarUtils.IN_DETAIL_DEBUG) {
						models.utils.LogUtils.printLogNormal("File " + fileName);
					}
					fileNameList.add(fileName);
				}
			} else if (virtualFileList.get(i).getRealFile().isDirectory()) {
				models.utils.LogUtils.printLogNormal("Directory "
						+ virtualFileList.get(i).getName());
			}
		}// end for

	} catch (Throwable t) {
		t.printStackTrace();
	}
	return fileNameList;
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:49,代码来源:FileIoUtils.java

示例7: getFileAndDirNamesInFolder

import play.vfs.VirtualFile; //导入方法依赖的package包/类
/**
 * Output both This will display all files except for empty.txt refined
 * 20130918
 * 
 * @param folderName
 * @return
 */
public static void getFileAndDirNamesInFolder(String folderName,
		List<String> fileNames, List<String> dirNames) {

	if (fileNames == null) {
		fileNames = new ArrayList<String>();
	}

	if (dirNames == null) {
		dirNames = new ArrayList<String>();
	}

	try {

		VirtualFile virtualDir = VirtualFile.fromRelativePath(folderName);
		List<VirtualFile> virtualFileList = virtualDir.list();

		if (virtualFileList == null) {
			 models.utils.LogUtils.printLogError
					 ("virtualFileList is NULL! in getFileNamesInFolder()"
							+ DateUtils.getNowDateTimeStrSdsm());
		}

		models.utils.LogUtils.printLogNormal("Under folder: " + folderName
				+ ",  File/dir count is " + virtualFileList.size());

		for (int i = 0; i < virtualFileList.size(); i++) {

			String fileOrDirName = virtualFileList.get(i).getName();
			if (virtualFileList.get(i).getRealFile().isFile()) {

				if ((!fileOrDirName
						.equalsIgnoreCase(VarUtils.FILE_NAME_APP_LOG_EMPTY))) {

					if (VarUtils.IN_DETAIL_DEBUG) {
						models.utils.LogUtils.printLogNormal("File " + fileOrDirName);
					}
					fileNames.add(fileOrDirName);
				}
			} else if (virtualFileList.get(i).getRealFile().isDirectory()) {
				models.utils.LogUtils.printLogNormal("Directory " + fileOrDirName);
				dirNames.add(fileOrDirName);

			}
		}// end for

	} catch (Throwable t) {
		t.printStackTrace();
	}
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:57,代码来源:FileIoUtils.java

示例8: deleteAllFileAndDirInFolder

import play.vfs.VirtualFile; //导入方法依赖的package包/类
/**
 * This will delete all files and folder under the path. Very careful
 * 20130918
 * 
 * SAFE GUARD: only with adhoc logs
 * 
 * @param folderName
 * @return
 */
public static boolean deleteAllFileAndDirInFolder(String folderName) {

	boolean success = true;

	// safeguard:
	if (!(folderName.contains("adhoc") || folderName.contains("logs"))) {
		 models.utils.LogUtils.printLogError
				 ("Looks like this folder is not logs folder in deleteAllFileAndDirInFolder(). Safeguard activated. "
						+ "NO OPS on this case. Return. ForderName:"
						+ folderName);
		return success;
	}

	try {

		VirtualFile virtualDir = VirtualFile.fromRelativePath(folderName);
		List<VirtualFile> virtualFileList = virtualDir.list();

		if (virtualFileList == null) {
			 models.utils.LogUtils.printLogError
					 ("virtualFileList is NULL! in getFileNamesInFolder()"
							+ DateUtils.getNowDateTimeStrSdsm());
		}

		models.utils.LogUtils.printLogNormal("Delete: Under folder: " + folderName
				+ ",  File/dir count is " + virtualFileList.size());

		for (int i = 0; i < virtualFileList.size(); i++) {

			if (virtualFileList.get(i).getRealFile().isFile()) {
				String fileName = virtualFileList.get(i).getName();

				if ((!fileName
						.equalsIgnoreCase(VarUtils.FILE_NAME_APP_LOG_EMPTY))) {

					if (VarUtils.IN_DETAIL_DEBUG) {
						models.utils.LogUtils.printLogNormal("File " + fileName);
					}

					FileUtils.forceDelete(virtualFileList.get(i)
							.getRealFile());
				}
			} else if (virtualFileList.get(i).getRealFile().isDirectory()) {
				models.utils.LogUtils.printLogNormal("Directory "
						+ virtualFileList.get(i).getName());

				FileUtils.deleteDirectory(virtualFileList.get(i)
						.getRealFile());
			}
		}// end for

	} catch (Throwable t) {
		t.printStackTrace();
		success = false;
	}

	return success;
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:68,代码来源:FileIoUtils.java


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