开发者

Uniform mechanism to enumerate file and Jar resources

I need to create a Collection<URL> from resources (files) residing in a specific folder. This folder may be accessed directly as a file: URL, or it may be contained in a jar file, access开发者_高级运维ed via a jar: URL. I know how to enumerate file: folder resources, and how to enumerate members in a jar/zip archive. I wonder if there is a uniform mechanism, saving myself the need to write the code for both cases.

Update: Note that the list of resources is not known at build time.


I wonder if there is a uniform mechanism, ..

Sure:

  1. Create a list of the resources (at build time).
  2. Put that list at a known location.
  3. Load the list to find out what resources are available, and their names.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜