Getting a list of newsgroups |
After establishing a connection you may get a list of available newsgroups on the NNTP server using the Nntp#getNewsgroups method. This will return a java.util.Enumeration of NntpNewsgroup. See JavaDoc for more information on available methods in NntpNewsgroup class.
Example
// get all newsgroups Enumeration groups = nntp.getNewsgroups();
// loop thru groups while(groups.hasMoreElements()) { NntpNewsgroup group = (NntpNewsgroup)groups.nextElement(); // print out name of group System.out.println(group.getName()); } |