• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JarFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
@Test
    public void test() {
        try {
            JarFile.registerUrlProtocolHandler();
            LaunchedURLClassLoader classLoader = new LaunchedURLClassLoader(
                    new URL[] {
                            new URL("jar:file:/Users/fangjian/Develop/gitrepository/springboot-analysis/springboot-executable-jar/target/executable-jar-1.0-SNAPSHOT.jar!/lib/spring-boot-loader-1.3.5.RELEASE.jar!/")
                            , new URL("jar:file:/Users/fangjian/Develop/gitrepository/springboot-analysis/springboot-executable-jar/target/executable-jar-1.0-SNAPSHOT.jar!/lib/spring-boot-1.3.5.RELEASE.jar!/")
                    },
                    LaunchedURLClassLoaderTest.class.getClassLoader());

//            classLoader.loadClass("org.springframework.boot.loader.JarLauncher");
//            classLoader.loadClass("org.springframework.boot.SpringApplication");
            classLoader.loadClass("org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
开发者ID:fangjian0423,项目名称:springboot-analysis,代码行数:19,代码来源:LaunchedURLClassLoaderTest.java


示例2: BootApplicationConfigurationMetadataResolver

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
public BootApplicationConfigurationMetadataResolver(ClassLoader parent) {
	this.parent = parent;
	JarFile.registerUrlProtocolHandler();
	try {
		Resource[] globalResources = new PathMatchingResourcePatternResolver(ApplicationConfigurationMetadataResolver.class.getClassLoader()).getResources(WHITELIST_PROPERTIES);
		loadWhiteLists(globalResources, globalWhiteListedClasses, globalWhiteListedProperties);
	}
	catch (IOException e) {
		throw new RuntimeException("Error reading global white list of configuration properties", e);
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:12,代码来源:BootApplicationConfigurationMetadataResolver.java


示例3: getNestedArchive

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
protected Archive getNestedArchive(Entry entry) throws IOException {
	JarEntry jarEntry = ((JarFileEntry) entry).getJarEntry();
	if (jarEntry.getComment().startsWith(UNPACK_MARKER)) {
		return getUnpackedNestedArchive(jarEntry);
	}
	JarFile jarFile = this.jarFile.getNestedJarFile(jarEntry);
	return new JarFileArchive(jarFile);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:JarFileArchive.java


示例4: resolveFromNested

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
@Test
public void resolveFromNested() throws Exception {
	File file = this.temporaryFolder.newFile();
	TestJarCreator.createTestJar(file);
	JarFile jarFile = new JarFile(file);
	URL url = jarFile.getUrl();
	LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { url },
			null);
	URL resource = loader.getResource("nested.jar!/3.dat");
	assertThat(resource.toString()).isEqualTo(url + "nested.jar!/3.dat");
	assertThat(resource.openConnection().getInputStream().read()).isEqualTo(3);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:LaunchedURLClassLoaderTests.java


示例5: BootApplicationConfigurationMetadataResolver

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
public BootApplicationConfigurationMetadataResolver(ClassLoader parent) {
	this.parent = parent;
	JarFile.registerUrlProtocolHandler();
	try {
		Resource[] globalResources = new PathMatchingResourcePatternResolver(
				ApplicationConfigurationMetadataResolver.class.getClassLoader()).getResources(WHITELIST_PROPERTIES);
		loadWhiteLists(globalResources, globalWhiteListedClasses, globalWhiteListedProperties);
	}
	catch (IOException e) {
		throw new RuntimeException("Error reading global white list of configuration properties", e);
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:13,代码来源:BootApplicationConfigurationMetadataResolver.java


示例6: JarFileArchive

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
public JarFileArchive(JarFile jarFile) {
	this.jarFile = jarFile;
	ArrayList<Entry> jarFileEntries = new ArrayList<Entry>();
	for (JarEntryData data : jarFile) {
		jarFileEntries.add(new JarFileEntry(data));
	}
	this.entries = Collections.unmodifiableList(jarFileEntries);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:9,代码来源:JarFileArchive.java


示例7: getNestedArchive

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
protected Archive getNestedArchive(Entry entry) throws IOException {
	JarEntryData data = ((JarFileEntry) entry).getJarEntryData();
	if (data.getComment().startsWith(UNPACK_MARKER)) {
		return getUnpackedNestedArchive(data);
	}
	JarFile jarFile = this.jarFile.getNestedJarFile(data);
	return new JarFileArchive(jarFile);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:9,代码来源:JarFileArchive.java


示例8: getFilteredArchive

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
@Override
public Archive getFilteredArchive(final EntryRenameFilter filter) throws IOException {
	JarFile filteredJar = this.jarFile.getFilteredJarFile(new JarEntryFilter() {
		@Override
		public AsciiBytes apply(AsciiBytes name, JarEntryData entryData) {
			return filter.apply(name, new JarFileEntry(entryData));
		}
	});
	return new JarFileArchive(filteredJar);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:JarFileArchive.java


示例9: launch

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
/**
 * Launch the application. This method is the initial entry point that should be
 * called by a subclass {@code public static void main(String[] args)} method.
 * @param args the incoming arguments
 */
protected void launch(String[] args) {
	try {
		JarFile.registerUrlProtocolHandler();
		ClassLoader classLoader = createClassLoader(getClassPathArchives());
		launch(args, getMainClass(), classLoader);
	}
	catch (Exception ex) {
		ex.printStackTrace();
		System.exit(1);
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:17,代码来源:Launcher.java


示例10: resolveFromNested

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
@Test
public void resolveFromNested() throws Exception {
	File file = this.temporaryFolder.newFile();
	TestJarCreator.createTestJar(file);
	JarFile jarFile = new JarFile(file);
	URL url = jarFile.getUrl();
	LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { url },
			null);
	URL resource = loader.getResource("nested.jar!/3.dat");
	assertThat(resource.toString(), equalTo(url + "nested.jar!/3.dat"));
	assertThat(resource.openConnection().getInputStream().read(), equalTo(3));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:13,代码来源:LaunchedURLClassLoaderTests.java


示例11: start

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
public static void start (String []args) {
    bootstrap = new Bootstrap ();
    try {
        JarFile.registerUrlProtocolHandler();
        classLoader = bootstrap.createClassLoader(bootstrap.getClassPathArchives());
        bootstrap.launch(args, bootstrap.getMainClass(), classLoader, true);
    }
    catch (Exception ex) {
        ex.printStackTrace();
        System.exit(1);
    }
}
 
开发者ID:francesc79,项目名称:test-procrun,代码行数:13,代码来源:Bootstrap.java


示例12: start

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
public static synchronized void start(String[] args) throws Exception {
    warlauncher = new MidPointWarLauncher();

    try {
        JarFile.registerUrlProtocolHandler();
        classLoader = warlauncher.createClassLoader(warlauncher.getClassPathArchives());
        warlauncher.launch(args, warlauncher.getMainClass(), classLoader, true);
    } catch (Exception ex) {
        StringBuilder sb = new StringBuilder();
        sb.append("Could not start MidPoint application").append(";").append(ex.getLocalizedMessage());
        throw new Exception(sb.toString(), ex);
    }
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:14,代码来源:MidPointWarLauncher.java


示例13: JarFileArchive

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
public JarFileArchive(File file, URL url) throws IOException {
	this(new JarFile(file));
	this.url = url;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:JarFileArchive.java


示例14: clearCache

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
private void clearCache(URLConnection connection) throws IOException {
	Object jarFile = ((JarURLConnection) connection).getJarFile();
	if (jarFile instanceof JarFile) {
		((JarFile) jarFile).clearCache();
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:LaunchedURLClassLoader.java


示例15: launch

import org.springframework.boot.loader.jar.JarFile; //导入依赖的package包/类
/**
 * Launch the application. This method is the initial entry point that should be
 * called by a subclass {@code public static void main(String[] args)} method.
 * @param args the incoming arguments
 * @throws Exception if the application fails to launch
 */
protected void launch(String[] args) throws Exception {
	JarFile.registerUrlProtocolHandler();
	ClassLoader classLoader = createClassLoader(getClassPathArchives());
	launch(args, getMainClass(), classLoader);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:Launcher.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PercolateResponse类代码示例发布时间:2022-05-23
下一篇:
Java SimpleEVD类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap