Getting the headers from an article |
You can get the headers from an article using the NntpArticle#getHeaders method. This will return a java.util.Enumeration of com.jscape.inet.mime.MimeHeader. The NntpArticle class is a subclass of NntpArticleHeader which is a subclass of com.jscape.inet.mime.MimeMessage thus exposing any methods found in this class. Convenience methods for retrieving common headers such as Subject, From, Date etc. are available from the NntpArticle class.
Example
// get article by id NntpArticle article = nntp.getArticle(12897);
// get headers for article Enumeration headers = article.getHeaders();
// print out header name and value while(headers.hasMoreElements()) { MimeHeader head = (MimeHeader)headers.nextElement(); System.out.println(head.getName() + ": " + head.getValue()); }
Example
// get article NntpArticle article = nntp.getArticle(first);
// print out subject header value System.out.println("Subject: " + article.getSubject());
|