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


Java FileSystemManager.createFileSystem方法代码示例

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


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

示例1: addFileObjects

import org.apache.commons.vfs2.FileSystemManager; //导入方法依赖的package包/类
/**
 * Appends the specified FileObjects to the list of FileObjects to search
 * for classes and resources.
 *
 * @param manager The FileSystemManager.
 * @param files the FileObjects to append to the search path.
 * @throws FileSystemException if an error occurs.
 */
private void addFileObjects(final FileSystemManager manager,
                            final FileObject[] files) throws FileSystemException
{
    for (int i = 0; i < files.length; i++)
    {
        FileObject file = files[i];
        if (!file.exists())
        {
            // Does not exist - skip
            continue;
        }

        // TODO - use federation instead
        if (manager.canCreateFileSystem(file))
        {
            // Use contents of the file
            file = manager.createFileSystem(file);
        }

        resources.add(file);
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:31,代码来源:VFSClassLoader.java

示例2: testDefaultInstance

import org.apache.commons.vfs2.FileSystemManager; //导入方法依赖的package包/类
/**
 * Sanity test.
 */
public void testDefaultInstance() throws Exception
{
    // Locate the default manager
    final FileSystemManager manager = VFS.getManager();

    // Lookup a test jar file
    final File jarFile = getTestResource("test.jar");
    FileObject file = manager.toFileObject(jarFile);
    assertNotNull(file);
    assertTrue(file.exists());
    assertSame(FileType.FILE, file.getType());

    // Expand it
    file = manager.createFileSystem(file);
    assertNotNull(file);
    assertTrue(file.exists());
    assertSame(FileType.FOLDER, file.getType());
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:22,代码来源:FileSystemManagerFactoryTestCase.java

示例3: getBaseTestFolder

import org.apache.commons.vfs2.FileSystemManager; //导入方法依赖的package包/类
/**
 * Returns the base folder for tests.
 */
@Override
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
{
    // Locate the base Zip file
    final String zipFilePath = AbstractVfsTestCase.getTestResource("nested.zip").getAbsolutePath();
    String uri = "zip:file:" + zipFilePath + "!/test.zip";
    final FileObject zipFile = manager.resolveFile(uri);

    // Now build the nested file system
    final FileObject nestedFS = manager.createFileSystem(zipFile);
    return nestedFS.resolveFile("/");
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:16,代码来源:NestedZipTestCase.java

示例4: getBaseTestFolder

import org.apache.commons.vfs2.FileSystemManager; //导入方法依赖的package包/类
/**
 * Returns the base folder for tests.
 */
@Override
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
{
    // Locate the Jar file
    final File outerFile = AbstractVfsTestCase.getTestResource("nested.jar");
    final String uri = "jar:file:" + outerFile.getAbsolutePath() + "!/test.jar";
    final FileObject jarFile = manager.resolveFile(uri);

    // Now build the nested file system
    final FileObject nestedFS = manager.createFileSystem(jarFile);
    return nestedFS.resolveFile("/");
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:16,代码来源:NestedJarTestCase.java

示例5: getBaseTestFolder

import org.apache.commons.vfs2.FileSystemManager; //导入方法依赖的package包/类
/**
 * Returns the base folder for tests.
 */
@Override
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
{
    // Locate the base Tar file
    final String tarFilePath = AbstractVfsTestCase.getTestResource("nested.tgz").getAbsolutePath();
    String uri = "tgz:file:" + tarFilePath + "!/test.tgz";
    final FileObject tarFile = manager.resolveFile(uri);

    // Now build the nested file system
    final FileObject nestedFS = manager.createFileSystem(tarFile);
    return nestedFS.resolveFile("/");
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:16,代码来源:NestedTgzTestCase.java

示例6: getBaseTestFolder

import org.apache.commons.vfs2.FileSystemManager; //导入方法依赖的package包/类
/**
 * Returns the base folder for tests.
 */
@Override
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
{
    // Locate the base Tar file
    final String tarFilePath = AbstractVfsTestCase.getTestResource("nested.tar").getAbsolutePath();
    String uri = "tar:file:" + tarFilePath + "!/test.tar";
    final FileObject tarFile = manager.resolveFile(uri);

    // Now build the nested file system
    final FileObject nestedFS = manager.createFileSystem(tarFile);
    return nestedFS.resolveFile("/");
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:16,代码来源:NestedTarTestCase.java

示例7: getBaseTestFolder

import org.apache.commons.vfs2.FileSystemManager; //导入方法依赖的package包/类
/**
 * Returns the base folder for tests.
 */
@Override
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
{
    // Locate the base Tar file
    final String tarFilePath = AbstractVfsTestCase.getTestResource("nested.tbz2").getAbsolutePath();
    String uri = "tbz2:file:" + tarFilePath + "!/test.tbz2";
    final FileObject tarFile = manager.resolveFile(uri);

    // Now build the nested file system
    final FileObject nestedFS = manager.createFileSystem(tarFile);
    return nestedFS.resolveFile("/");
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:16,代码来源:NestedTbz2TestCase.java

示例8: openRepository

import org.apache.commons.vfs2.FileSystemManager; //导入方法依赖的package包/类
private void openRepository() {
	File testRepositoryBaseDir = getTestRepositoryBaseDir();

	try {
		FileSystemManager manager = VFS.getManager();
		if (repositoryPath.startsWith(CLASSPATH_PREFIX)) {
			String res = "res:"
					+ repositoryPath.substring(CLASSPATH_PREFIX.length());
			FileObject packFileObject = manager.resolveFile(res);
			try {

				FileObject zipFileSystem = manager
						.createFileSystem(packFileObject);

				try {

					FileObject targetDir = manager
							.toFileObject(testRepositoryBaseDir);
					targetDir.delete(Selectors.SELECT_ALL);
					targetDir.copyFrom(zipFileSystem, Selectors.SELECT_ALL);

					testRepositoryBaseDir = resolveRepositoryDirectory(testRepositoryBaseDir);
				} finally {
					zipFileSystem.close();
				}
			} finally {
				packFileObject.close();
			}

		} else {
			throw new UnsupportedOperationException(
					"GitRepository.value() must be a classpath:... resource");
		}
		RepositoryBuilder repositoryBuilder = new RepositoryBuilder();
		repositoryBuilder.readEnvironment();
		repositoryBuilder.findGitDir(testRepositoryBaseDir);
		Repository repository = repositoryBuilder.build();
		git = new Git(repository);
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:link-intersystems,项目名称:GitDirStat,代码行数:43,代码来源:DefaultTestRepository.java


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