本文整理汇总了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);
}
}
示例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());
}
示例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("/");
}
示例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("/");
}
示例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("/");
}
示例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("/");
}
示例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("/");
}
示例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);
}
}