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


Java FilesCache类代码示例

本文整理汇总了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;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:15,代码来源:AbstractFileSystem.java

示例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;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:16,代码来源:DefaultFileSystemManager.java

示例3: getFilesCache

import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
public FilesCache getFilesCache()
{
    if (cache == null)
    {
        // cache = new DefaultFilesCache();
        cache = new SoftRefFilesCache();
    }

    return cache;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:11,代码来源:AbstractProviderTestConfig.java

示例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;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:9,代码来源:DefaultFileSystemManager.java

示例5: getFilesCache

import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
public FilesCache getFilesCache()
{
    return new NullFilesCache();
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:5,代码来源:NullFilesCacheTestCase.java

示例6: getFilesCache

import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
public FilesCache getFilesCache()
{
    return new LRUFilesCache(5);
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:5,代码来源:LRUFilesCacheTestCase.java

示例7: getFilesCache

import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
public FilesCache getFilesCache()
{
    return config.getFilesCache();
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:5,代码来源:JunctionProviderConfig.java

示例8: getFilesCache

import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
public FilesCache getFilesCache() {
    return cache;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:4,代码来源:TestProActiveProvider.java

示例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();
    }
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:61,代码来源:FilehandlingServiceTest.java

示例10: getFilesCache

import org.apache.commons.vfs.FilesCache; //导入依赖的package包/类
/**
 * Returns the filesCache implementation used for tests.
 */
FilesCache getFilesCache();
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:5,代码来源:ProviderTestConfig.java


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