在OSGI软件包中查找文件和文件夹 [英] Finding files and folders in an OSGI Bundle

查看:142
本文介绍了在OSGI软件包中查找文件和文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写必须在osgi环境中执行的测试用例,我将测试数据放在测试包中。我可以使用bundle.getResource访问测试数据文件,该文件返回一个URL,我可以从中获取特定文件的InputStream,但是如何找到测试插件中特定文件夹中的所有文件列表。在eclispe我可以使用fileLocator来执行此操作。



/ bundle

      testdata

         one.txt

         two.txt

         three.txt

         folder1

                file1.txt

                 file2.txt



在上面的包中想要查找testdata文件夹中存在的所有文件和文件夹。





最佳版本,

Keshav

解决方案

如果您知道信息是什么包,请使用Bundle.findEntries或Bundle.getEntryPaths。


I am writing test cases that have to be executed in osgi environment, i have put the test data which is a set of files in the test bundle. I am able to access the test data files using bundle.getResource which returns an URL from which i can get the InputStream for a particular file, but how can i find out all the list of files in a particular folder in the test plugin. In eclispe i could use fileLocator to do this.

/bundle
     testdata
        one.txt
        two.txt
        three.txt
        folder1
               file1.txt
               file2.txt

In the above bundle i want to find all the files and folders that are present in the testdata folder.


Best Reards,
Keshav

解决方案

If you know what bundle the information is in, use Bundle.findEntries or Bundle.getEntryPaths.

这篇关于在OSGI软件包中查找文件和文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆