當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。