使用 Java 获取存档内文件的 File 或 URI 对象? [英] Get a File or URI object for a file inside an archive with Java?
本文介绍了使用 Java 获取存档内文件的 File 或 URI 对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用 Java 获取存档内文件的 File 或 URI 对象?(zip 或 jar 档案)
is it possible to get a File or URI object for a file inside an archive with Java? (zip or jar archive)
谢谢 Hemeroc.
Thanks Hemeroc.
推荐答案
jar:
协议是一种为 JAR 存档中的资源构建 URI 的方法:
The jar:
protocol is a way to build a URI to a resource in a JAR archive:
jar:http://www.example.com/bar/baz.jar!/path/to/file
查看 JarURLConnection 的 API 文档:http://java.sun.com/javase/6/docs/api/java/net/JarURLConnection.html
See the API docs for JarURLConnection: http://java.sun.com/javase/6/docs/api/java/net/JarURLConnection.html
jar:
和 !/
之间可以是任何 URL,包括 file:
URL.
Between the jar:
and !/
can be any URL, including a file:
URL.
这篇关于使用 Java 获取存档内文件的 File 或 URI 对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文