📄 helloevo.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package helloworld;import java.io.*;import net.jxta.peergroup.*;import net.jxta.peergroup.PeerGroupFactory;import net.jxta.exception.PeerGroupException;import net.jxta.document.*;import net.jxta.peer.*;import net.jxta.discovery.*;import net.jxta.pipe.*;import net.jxta.membership.*;import net.jxta.resolver.*;/** import net.jxta.protocol;import net.jxta.document;* * @author Word List */public class helloworld { static PeerGroup group; static Advertisement pgadv; /** * @param args the command line arguments */ public static void main(String[] args) { helloworld myapp = new helloworld(); myapp.startJxta();// TODO code application logic here System.exit (0); } private void startJxta() { try { group = PeerGroupFactory.newNetPeerGroup(); }catch(PeerGroupException e) { System.out.println("ER"); System.exit(1); } System.out.println("Started helloworld"); pgadv = group.getPeerGroupAdvertisement(); try { StructuredTextDocument doc = (StructuredTextDocument) pgadv.getDocument(new MimeMediaType("text/plain")); StringWriter out = new StringWriter(); doc.sendToWriter(out); System.out.println(out.toString()); out.close(); } catch(Exception ex) {ex.printStackTrace();} //peergroup service PeerGroupID pgid = group.getPeerGroupID(); System.out.println("pgid = " + pgid); PeerID pid = group.getPeerID(); System.out.println("pid = " + pid); String name = group.getPeerName(); System.out.println("peer name : " + name); //Get Core services. DiscoveryService disco = group.getDiscoveryService(); PipeService pipe = group.getPipeService(); MembershipService member = group.getMembershipService(); ResolverService resolv = group.getResolverService(); System.out.println("All done."); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -