本文整理汇总了Java中org.apache.commons.io.comparator.SizeFileComparator类的典型用法代码示例。如果您正苦于以下问题:Java SizeFileComparator类的具体用法?Java SizeFileComparator怎么用?Java SizeFileComparator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SizeFileComparator类属于org.apache.commons.io.comparator包,在下文中一共展示了SizeFileComparator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: largeContentCacheFilesAreNotKeptOnDisk
import org.apache.commons.io.comparator.SizeFileComparator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void largeContentCacheFilesAreNotKeptOnDisk() throws IOException
{
quota.setMaxFileSizeMB(3);
writeSingleFileInMB(1);
writeSingleFileInMB(2);
writeSingleFileInMB(3);
writeSingleFileInMB(4);
List<File> files = new ArrayList<File>(findCacheFiles());
assertEquals(3, files.size());
Collections.sort(files,SizeFileComparator.SIZE_COMPARATOR);
assertEquals(1, files.get(0).length() / FileUtils.ONE_MB);
assertEquals(2, files.get(1).length() / FileUtils.ONE_MB);
assertEquals(3, files.get(2).length() / FileUtils.ONE_MB);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:StandardQuotaStrategyTest.java
示例2: getBig
import org.apache.commons.io.comparator.SizeFileComparator; //导入依赖的package包/类
/**
* Get big files until 250 Mb
* @return big files until 250 Mb
*/
public static File [] getBig() {
FileFilter fileFilter = new FileFilter() {
// @Override
public boolean accept(File pathname) {
if (pathname.toString().endsWith("Mb.txt")) {
return true;
}
return false;
}
};
File[] files = FileGenerator.getHomeDirectory().listFiles(fileFilter);
Arrays.sort(files, SizeFileComparator.SIZE_COMPARATOR);
return files;
}
开发者ID:kawansoft,项目名称:awake-file,代码行数:24,代码来源:BigFiles.java
示例3: getFilesItemsInCurrentDirectory
import org.apache.commons.io.comparator.SizeFileComparator; //导入依赖的package包/类
public ArrayList<FileItem> getFilesItemsInCurrentDirectory() {
Operations op = Operations.getInstance(mContext);
Constants.SORT_OPTIONS option = op.getmCurrentSortOption();
Constants.FILTER_OPTIONS filterOption = op.getmCurrentFilterOption();
if (mFileNavigator.getmCurrentNode() == null) mFileNavigator.setmCurrentNode(mFileNavigator.getmRootNode());
File[] files = mFileNavigator.getFilesInCurrentDirectory();
if (files != null) {
mFiles.clear();
Comparator<File> comparator = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
switch(option) {
case SIZE:
comparator = SizeFileComparator.SIZE_COMPARATOR;
break;
case LAST_MODIFIED:
comparator = LastModifiedFileComparator.LASTMODIFIED_COMPARATOR;
break;
}
Arrays.sort(files,comparator);
for (int i = 0; i < files.length; i++) {
boolean addToFilter = true;
switch(filterOption) {
case FILES:
addToFilter = !files[i].isDirectory();
break;
case FOLDER:
addToFilter = files[i].isDirectory();
break;
}
if (addToFilter)
mFiles.add(new FileItem(files[i]));
}
}
return mFiles;
}
开发者ID:adityak368,项目名称:Android-FileBrowser-FilePicker,代码行数:35,代码来源:NavigationHelper.java
注:本文中的org.apache.commons.io.comparator.SizeFileComparator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论