本文整理汇总了Java中org.apache.commons.vfs.FilesCache类的典型用法代码示例。如果您正苦于以下问题:Java FilesCache类的具体用法?Java FilesCache怎么用?Java FilesCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FilesCache类属于org.apache.commons.vfs包,在下文中一共展示了FilesCache类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCache
import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
private FilesCache getCache()
{
FilesCache files;
//if (this.files == null)
//{
files = getContext().getFileSystemManager().getFilesCache();
if (files == null)
{
throw new RuntimeException(Messages.getString("vfs.provider/files-cache-missing.error"));
}
//}
return files;
}
示例2: setFilesCache
import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
/**
* Sets the filesCache implementation used to cache files.
* @param filesCache The FilesCache.
* @throws FileSystemException if an error occurs setting the cache..
*/
public void setFilesCache(final FilesCache filesCache)
throws FileSystemException
{
if (init)
{
throw new FileSystemException("vfs.impl/already-inited.error");
}
this.filesCache = filesCache;
}
示例3: getFilesCache
import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
public FilesCache getFilesCache()
{
if (cache == null)
{
// cache = new DefaultFilesCache();
cache = new SoftRefFilesCache();
}
return cache;
}
示例4: getFilesCache
import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
/**
* Returns the filesCache implementation used to cache files.
* @return The FilesCache.
*/
public FilesCache getFilesCache()
{
return filesCache;
}
示例5: getFilesCache
import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
public FilesCache getFilesCache()
{
return new NullFilesCache();
}
示例6: getFilesCache
import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
public FilesCache getFilesCache()
{
return new LRUFilesCache(5);
}
示例7: getFilesCache
import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
public FilesCache getFilesCache()
{
return config.getFilesCache();
}
示例8: getFilesCache
import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
public FilesCache getFilesCache() {
return cache;
}
示例9: testCaching1
import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
@Test
public void testCaching1() throws Exception {
String testFolder = "d:/workspace/java/e-gov/eGovFramework/RTE/DEV/trunk/Foundation/egovframework.rte.fdl.filehandling/test";
FileSystemManager manager = VFS.getManager();
EgovFileUtil.writeFile(testFolder + "/file1.txt", text, "UTF-8");
/*
* 캐싱 Manager 생성
* CacheStrategy.MANUAL : Deal with cached data manually. Call FileObject.refresh() to refresh the object data.
* CacheStrategy.ON_RESOLVE : Refresh the data every time you request a file from FileSystemManager.resolveFile
* CacheStrategy.ON_CALL : Refresh the data every time you call a method on the fileObject. You'll use this only if you really need the latest info as this setting is a major performance loss.
*/
DefaultFileSystemManager fs = new DefaultFileSystemManager();
fs.setFilesCache(manager.getFilesCache());
// zip, jar, tgz, tar, tbz2, file
if (!fs.hasProvider("file")) {
fs.addProvider("file", new DefaultLocalFileProvider());
}
// StandardFileSystemManager fs = new StandardFileSystemManager();
fs.setCacheStrategy(CacheStrategy.ON_RESOLVE);
fs.init();
// 캐싱 객체 생성
//FileObject foBase2 = fs.resolveFile(testFolder);
log.debug("####1");
FileObject cachedFile = fs.toFileObject(new File(testFolder + "/file1.txt"));
log.debug("####2");
FilesCache filesCache = fs.getFilesCache();
log.debug("####3");
filesCache.putFile(cachedFile);
FileObject obj = filesCache.getFile(cachedFile.getFileSystem(), cachedFile.getName());
//FileObject baseFile = fs.getBaseFile();
// log.debug("### cachedFile.getContent().getSize() is " + cachedFile.getContent().getSize());
// long fileSize = cachedFile.getContent().getSize();
// log.debug("#########size is " + fileSize);
//FileObject cachedFile1 = cachedFile.resolveFile("file2.txt");
// FileObject scratchFolder = manager.resolveFile(testFolder);
// scratchFolder.delete(Selectors.EXCLUDE_SELF);
EgovFileUtil.delete(new File(testFolder + "/file1.txt"));
// obj.createFile();
// log.debug("#########obj is " + obj.toString());
// log.debug("#########size is " + obj.getContent().getSize());
log.debug("#########file is " + obj.exists());
fs.close();
}
示例10: getFilesCache
import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
/**
* Returns the filesCache implementation used for tests.
*/
FilesCache getFilesCache();