首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JXTA 2.7上缺少的方法

JXTA 2.7上缺少的方法
EN

Stack Overflow用户
提问于 2011-09-05 03:40:15
回答 2查看 530关注 0票数 0

我已经开始阅读“实用JXTA II”中的“如何将JXTA用于我想做的应用程序”。尽管所提供的代码(示例)不适用于JXTA 2.7。更具体地说,Z_Tools_And_Others的Tools类没有编译,因为TheRendezVous类没有2.6中存在的getConnectedPeers()和getConnectedRendezVous()。因此,我不能继续,因为大多数示例中都使用了Tools类。熟悉这个的人有什么建议吗?是不是更好的做法是先使用2.6进行学习,然后再迁移到2.7?

谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-09-11 03:46:37

很抱歉回复得太晚了:实用JXTA II的文件可以从here获得。

我非常确定您正在尝试使用带有2.7的2.6代码。如果您在使用jxta II的实际示例时仍然遇到问题,请告诉我。

票数 1
EN

Stack Overflow用户

发布于 2011-09-12 07:13:15

代码语言:javascript
复制
package Examples.Z_Tools_And_Others;

public class Tools {
public static void popConnectedRendezvous(RendezVousService TheRendezVous, String Name) {

        Enumeration<ID> TheList = TheRendezVous.getConnectedRendezVous();
        int Count = 0;

        while (TheList.hasMoreElements()) {

            Count = Count + 1;

            PopInformationMessage(Name, "Connected to rendezvous:\n\n"
                    + TheList.nextElement().toString());

        }

        if (Count==0) {

            PopInformationMessage(Name, "No rendezvous connected to this rendezvous!");

        }

    }

TheList不工作.The方法getConnectedRendezVous在2.7中被删除。替换它的是返回一个列表,.That以后会产生更多的错误。我想我可以用一个listIterator来代替.nextElement(),同样的问题也存在于相同类的popConnectedPeers(RendezVousService TheRendezVous,String Name)。

另请参阅第166行

打包Examples.K_Service;

公共类_710_Astrology_Service_Example实现服务,可运行

Result.setCompat(StdPeerGroup.STD_COMPAT);

STD_COMPAT将被删除。我将其替换为:

ModuleImplAdvertisement ad =StdPeerGroup.getDefaultModuleImplAdvertisement();

Result.setCompat(ad.getCompat());

不知道它是好的还是not..code编译了tho :P

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7301676

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档