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


Java JarFileProvider类代码示例

本文整理汇总了Java中org.apache.commons.vfs2.provider.jar.JarFileProvider的典型用法代码示例。如果您正苦于以下问题:Java JarFileProvider类的具体用法?Java JarFileProvider怎么用?Java JarFileProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JarFileProvider类属于org.apache.commons.vfs2.provider.jar包,在下文中一共展示了JarFileProvider类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addProviders

import org.apache.commons.vfs2.provider.jar.JarFileProvider; //导入依赖的package包/类
protected void addProviders(DefaultFileSystemManager manager) throws FileSystemException {
    manager.addProvider("tmp", new TemporaryFileProvider());
    manager.addProvider("res", new ResourceFileProvider());
    manager.addProvider("ram", new RamFileProvider());
    manager.addProvider("zip", new ZipFileProvider());
    manager.addProvider("jar", new JarFileProvider());
    manager.addProvider("tar", new TarFileProvider());
    manager.addProvider("tgz", new TgzFileProvider());
    manager.addProvider("tbz2", new Tbz2FileProvider());
    manager.addProvider("gz", new GzipFileProvider());
    manager.addProvider("bz2", new Bzip2FileProvider());
    manager.addProvider("http", new HttpFileProvider());
    manager.addProvider("https", new HttpsFileProvider());
    manager.addProvider("webdav", new WebdavFileProvider());
    manager.addProvider("ftp", new FtpFileProvider());
    manager.addProvider("ftps", new FtpsFileProvider());
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:18,代码来源:DefaultFileSystemManagerProvider.java

示例2: prepare

import org.apache.commons.vfs2.provider.jar.JarFileProvider; //导入依赖的package包/类
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager)
    throws Exception
{
    manager.addProvider("jar", new JarFileProvider());
    manager.addExtensionMap("jar", "jar");
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:11,代码来源:NestedJarTestCase.java

示例3: prepare

import org.apache.commons.vfs2.provider.jar.JarFileProvider; //导入依赖的package包/类
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager)
    throws Exception
{
    manager.addProvider("jar", new JarFileProvider());
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:10,代码来源:JarProviderTestCase.java

示例4: prepare

import org.apache.commons.vfs2.provider.jar.JarFileProvider; //导入依赖的package包/类
/**
 * Prepares the file system manager.  This implementation does nothing.
 */
@Override
public void prepare(DefaultFileSystemManager manager)
    throws Exception
{
    manager.addProvider("res", new ResourceFileProvider());
    manager.addProvider("file", new UrlFileProvider());
    manager.addProvider("jar", new JarFileProvider());
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:12,代码来源:ResourceProviderTestCase.java

示例5: test

import org.apache.commons.vfs2.provider.jar.JarFileProvider; //导入依赖的package包/类
@Test
public void test()
		// HPFortify FP: unit test not subject to security vulnerability
		throws FileSystemException,
		MalformedURLException {
	DefaultFileSystemManager fsManager = new DefaultFileSystemManager();
	fsManager.setCacheStrategy(CacheStrategy.MANUAL);
	fsManager.setFilesCache(new SoftRefFilesCache());
	fsManager.addProvider(
			"file",
			new DefaultLocalFileProvider());
	fsManager.addProvider(
			"jar",
			new JarFileProvider());
	fsManager.setBaseFile(new File(
			"."));

	// fsManager.addProvider("jar", new JarFileProvider());
	fsManager.init();
	FileObject jarFile = fsManager.resolveFile("jar:src/test/test.jar");

	final VFSClassLoader cl = new VFSClassLoader(
			jarFile,
			fsManager);

	final FileObject[] fileObjs = cl.getFileObjects();
	final URL[] fileUrls = new URL[fileObjs.length];
	for (int i = 0; i < fileObjs.length; i++) {
		fileUrls[i] = new URL(
				fileObjs[i].toString());
	}
	SPIServiceRegistry registry = new SPIServiceRegistry(
			FieldSerializationProviderSpi.class);
	registry.registerLocalClassLoader(java.security.AccessController
			.doPrivileged(new java.security.PrivilegedAction<URLClassLoader>() {
				public URLClassLoader run() {
					final URLClassLoader ucl = new URLClassLoader(
							fileUrls,
							cl);
					return ucl;
				}
			}));

	// Proves that the VFS Classloader SPI loading bug exists
	Iterator<FieldSerializationProviderSpi> it1 = ServiceLoader.load(
			FieldSerializationProviderSpi.class).iterator();
	boolean found = false;
	while (it1.hasNext()) {
		found |= it1.next().getClass().equals(
				BooleanSerializationProvider.class);
	}
	assertFalse(found);

	Iterator<FieldSerializationProviderSpi> it = registry.load(FieldSerializationProviderSpi.class);
	found = false;
	try {
		while (it.hasNext()) {
			found |= it.next().getClass().equals(
					BooleanSerializationProvider.class);
		}
	}
	catch (Throwable ex) {

		assertTrue(ex instanceof NoClassDefFoundError && ex.getLocalizedMessage().contains(
				"FieldSerializationProviderSpi"));
		return;
	}
	assertTrue(
			"The class not found exception is expected since the JAR file was not registered",
			false);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:72,代码来源:SPIServiceRegistryTest.java


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