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


Java FileSystemProvider.installedProviders方法代码示例

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


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

示例1: initFileSystemProvider

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
/**
 * Initialize the FileSystemProvider. This method should be called before
 * system property os.name is set. See see bug 235739.
 */
private static void initFileSystemProvider() {
    try {
        FileSystemProvider.installedProviders();
        new File(".").isFile();
    } catch (Exception e) {
        Logger.getLogger(NbKeymapTest.class.getName()).log(
                Level.INFO, null, e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:NbKeymapTest.java

示例2: getJarFSProvider

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
public synchronized FileSystemProvider getJarFSProvider() {
    if (jarFSProvider != null) {
        return jarFSProvider;
    }
    for (FileSystemProvider provider: FileSystemProvider.installedProviders()) {
        if (provider.getScheme().equals("jar")) {
            return (jarFSProvider = provider);
        }
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:FSInfo.java

示例3: getJarFSProvider

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
private FileSystemProvider getJarFSProvider() throws IOException {
    if (jarFSProvider != null) {
        return jarFSProvider;
    }
    for (FileSystemProvider provider: FileSystemProvider.installedProviders()) {
        if (provider.getScheme().equals("jar")) {
            return (jarFSProvider = provider);
        }
    }
    throw new ProviderNotFoundException("no provider found for .jar files");
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:12,代码来源:JavacFileManager.java

示例4: main

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
public static void main(String[] args) 
		 throws IOException {
    // ftp localhost
    // filedrop/filedrop

    List<FileSystemProvider> providers = FileSystemProvider.installedProviders();
    for (FileSystemProvider provider : providers)
        System.out.println(provider);

}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:11,代码来源:FTPTest.java

示例5: isJarFileSystemAvailable

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
boolean isJarFileSystemAvailable() {
    boolean result = false;
    for (FileSystemProvider fsp: FileSystemProvider.installedProviders()) {
        String scheme = fsp.getScheme();
        System.err.println("Provider: " + scheme + " " + fsp);
        if (scheme.equalsIgnoreCase("jar") || scheme.equalsIgnoreCase("zip"))
            result = true;
    }
    return result;
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:11,代码来源:CompileTest.java

示例6: loadFileSystemProvider

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
private static FileSystemProvider loadFileSystemProvider(String providerType) {
    FileSystemProvider provider = null;
    for ( FileSystemProvider p : FileSystemProvider.installedProviders() ) {
        if ( providerType.equals(p.getScheme()) ) {
            provider = p;
            break;
        }
    }
    return provider;
}
 
开发者ID:advantageous,项目名称:boon,代码行数:11,代码来源:IO.java

示例7: getInstance

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
public static BundleFileSystemProvider getInstance() {
	for (FileSystemProvider provider : FileSystemProvider
			.installedProviders()) {
		if (provider instanceof BundleFileSystemProvider) {
			return (BundleFileSystemProvider) provider;
		}
	}
	// Not installed!
	// Fallback for OSGi environments
	return Singleton.INSTANCE;
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:12,代码来源:BundleFileSystemProvider.java

示例8: installedProviders

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
@Test
public void installedProviders() throws Exception {
	for (FileSystemProvider provider : FileSystemProvider
			.installedProviders()) {
		if (provider instanceof BundleFileSystemProvider) {
			assertSame(provider, BundleFileSystemProvider.getInstance());
			return;
		}
	}
	fail("Could not find BundleFileSystemProvider as installed provider");
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:12,代码来源:TestFileSystemProvider.java

示例9: getInstalledProvider

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
@Nonnull
private static GitFileSystemProvider getInstalledProvider() {
  GitFileSystemProvider ret = null;
  for(FileSystemProvider provider : FileSystemProvider.installedProviders()) {
    if(provider instanceof GitFileSystemProvider) {
      ret = (GitFileSystemProvider) provider;
      break;
    }
  }
  if(ret == null)
    ret = new GitFileSystemProvider();
  return ret;
}
 
开发者ID:beijunyi,项目名称:ParallelGit,代码行数:14,代码来源:GitFileSystemProvider.java

示例10: validateProviderLoaded

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
@Test
public void validateProviderLoaded() throws Exception {
	List<FileSystemProvider> providers = FileSystemProvider.installedProviders();
	int length = providers.stream().filter(x -> x instanceof HdfsFileSystemProvider).toArray().length;
	Assert.assertEquals(1, length);
	//FileSystem fs = FileSystems.getFileSystem(new URI("hdfs://hortonworks.com:9000"));
}
 
开发者ID:hortonworks,项目名称:dstream,代码行数:8,代码来源:HdfsFileSystemProviderTests.java

示例11: main

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    List<FileSystemProvider> providers = FileSystemProvider.installedProviders();
    for (FileSystemProvider fsProvider : providers) {
        System.out.println("sheme: '" + fsProvider.getScheme() + "', provider: " + fsProvider.getClass());
    }

    Path tmpFile = Files.createTempFile("", ".tmp");
    Files.write(tmpFile, "Hello".getBytes());
    Path jarFile = Files.createTempFile("", ".jar");

    try(JarOutputStream outputStream = new JarOutputStream(Files.newOutputStream(jarFile))){
        outputStream.putNextEntry(new ZipEntry(tmpFile.getFileName().toString()));
        Files.copy(tmpFile, outputStream);
    }

    try(FileSystem fileSystem = createVirtualFS(jarFile)){
        Iterable<Path> directories = fileSystem.getRootDirectories();
        for (Path dir : directories) {
            System.out.println("Reading dir: " + dir.toUri());
            DirectoryStream<Path> stream = Files.newDirectoryStream(dir);
            for (Path file : stream) {
                System.out.println("Reading file: " + file.toUri());
                System.out.println("\tfrom " + file.getFileSystem().provider().getClass());
                System.out.print("Content: ");
                Files.copy(file, System.out);
            }
        }
    }

}
 
开发者ID:iloveeclipse,项目名称:java7examples,代码行数:31,代码来源:FileSystemProviderAPI.java

示例12: testAutoRegister

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
/**
 * Check that a FileSystemProvider handle <code>hdfs</code> scheme.
 */
@Test
public void testAutoRegister() {

  boolean found = false;
  for (FileSystemProvider fp : FileSystemProvider.installedProviders())
    if (fp.getScheme().equals(HadoopFileSystemProvider.SCHEME))
      found = true;
  // Check auto register of the provider
  assertTrue(found);
}
 
开发者ID:damiencarol,项目名称:jsr203-hadoop,代码行数:14,代码来源:TestFileSystem.java

示例13: defaultInstance

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
static DxFileSystemProvider defaultInstance() {

        if( instance != null )
            return instance;

        for (FileSystemProvider provider : FileSystemProvider.installedProviders()) {
            if ( provider instanceof DxFileSystemProvider ) {
                return instance = (DxFileSystemProvider)provider;
            }
        }

        return null;
    }
 
开发者ID:nextflow-io,项目名称:jdk7-dxfs,代码行数:14,代码来源:DxFileSystemProvider.java

示例14: getProvider

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
public static FileSystemProvider getProvider(String scheme) {
    for (FileSystemProvider fsp : FileSystemProvider.installedProviders()) {
        if (fsp.getScheme().equals(scheme)) {
            return fsp;
        }
    }
    throw new IllegalArgumentException("No provider found for scheme: " + scheme);
}
 
开发者ID:gluster,项目名称:glusterfs-java-filesystem,代码行数:9,代码来源:Example.java

示例15: testFileSystemIsRegistered

import java.nio.file.spi.FileSystemProvider; //导入方法依赖的package包/类
public void testFileSystemIsRegistered() throws URISyntaxException {

		// Check that the expected "memory0" FileSystem is available
		boolean foundInitialProvider = false;

		for (FileSystemProvider provider: FileSystemProvider.installedProviders()) {
			if (provider.getScheme().equalsIgnoreCase("memory0")) {
				foundInitialProvider = true;
			}
		}

		assertTrue("Unable to find intial provider 'memory0'", foundInitialProvider);


		FileSystem memoryFileSystem = FileSystems.getFileSystem(new URI("memory0:///"));
		assertNotNull("Returned memoryFileSystem for 'memory0:///' was null", memoryFileSystem);

		String filename = "bargh";
		assertNotNull("Returned filename for 'memory0:///"+filename+"' was null", memoryFileSystem.getPath(filename));
		
		assertEquals("MemoryFileSystem did not return the expected string representation",
				"/memory/" + filename, memoryFileSystem.getPath(filename).toString());


	}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-systemtest,代码行数:26,代码来源:FileSystemsTest.java


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