Package org.apache.commons.net.nntp
Class Article
- java.lang.Object
-
- org.apache.commons.net.nntp.Article
-
- All Implemented Interfaces:
Threadable<Article>
public class Article extends java.lang.Object implements Threadable<Article>
Basic state needed for message retrieval and threading. With thanks to Jamie Zawinski (jwz@jwz.org)
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringarticleIdprivate longarticleNumberprivate java.lang.Stringdateprivate java.lang.Stringfromprivate booleanisReplyArticlekidDeprecated.UsesetChild(Article)andgetChild().ArticlenextDeprecated.UsesetNext(Article)andgetNext().private java.util.ArrayList<java.lang.String>referencesprivate java.lang.StringsimplifiedSubjectprivate java.lang.Stringsubject
-
Constructor Summary
Constructors Constructor Description Article()Constructs a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddHeaderField(java.lang.String name, java.lang.String val)Deprecated.voidaddReference(java.lang.String msgId)Adds a message-id to the list of messages that this message references (i.e.private voidflushSubjectCache()java.lang.StringgetArticleId()Gets the article ID.intgetArticleNumber()Deprecated.longgetArticleNumberLong()Gets the article number.ArticlegetChild()Gets the child article.java.lang.StringgetDate()Gets the article date header.java.lang.StringgetFrom()Gets the article from header.ArticlegetNext()Gets the next article.java.lang.String[]getReferences()Returns the MessageId references as an array of Stringsjava.lang.StringgetSubject()Gets the article subject.booleanisDummy()Tests whether this is a dummy instance.ArticlemakeDummy()Creates a dummy instance.java.lang.StringmessageThreadId()Gets an ID.java.lang.String[]messageThreadReferences()Gets reference strings.static voidprintThread(Article article)Recursive method that traverses a pre-threaded graph (or tree) of connected Article objects and prints them out.static voidprintThread(Article article, int depth)Recursive method that traverses a pre-threaded graph (or tree) of connected Article objects and prints them out.static voidprintThread(Article article, int depth, java.io.PrintStream ps)Recursive method that traverses a pre-threaded graph (or tree) of connected Article objects and prints them out.static voidprintThread(Article article, java.io.PrintStream ps)Recursive method that traverses a pre-threaded graph (or tree) of connected Article objects and prints them out.voidsetArticleId(java.lang.String string)Sets the article ID.voidsetArticleNumber(int articleNumber)Deprecated.voidsetArticleNumber(long articleNumber)Sets the article number.voidsetChild(Article child)Sets the child instance.voidsetDate(java.lang.String date)Sets the article date header.voidsetFrom(java.lang.String from)Sets the article from header.voidsetNext(Article next)Sets the next instance.voidsetSubject(java.lang.String subject)Sets the article subject.java.lang.StringsimplifiedSubject()Gets the simplified subject.private voidsimplifySubject()Attempts to parse the subject line for some typical reply signatures, and strip them outbooleansubjectIsReply()Tests whether this is a reply.java.lang.StringtoString()
-
-
-
Field Detail
-
articleNumber
private long articleNumber
-
subject
private java.lang.String subject
-
date
private java.lang.String date
-
articleId
private java.lang.String articleId
-
simplifiedSubject
private java.lang.String simplifiedSubject
-
from
private java.lang.String from
-
references
private java.util.ArrayList<java.lang.String> references
-
isReply
private boolean isReply
-
kid
@Deprecated public Article kid
Deprecated.UsesetChild(Article)andgetChild().Will be private in 4.0.
-
next
@Deprecated public Article next
Deprecated.UsesetNext(Article)andgetNext().Will be private in 4.0.
-
-
Method Detail
-
printThread
public static void printThread(Article article)
Recursive method that traverses a pre-threaded graph (or tree) of connected Article objects and prints them out.- Parameters:
article- the root of the article 'tree'- Since:
- 3.4
-
printThread
public static void printThread(Article article, int depth)
Recursive method that traverses a pre-threaded graph (or tree) of connected Article objects and prints them out.- Parameters:
article- the root of the article 'tree'depth- the current tree depth
-
printThread
public static void printThread(Article article, int depth, java.io.PrintStream ps)
Recursive method that traverses a pre-threaded graph (or tree) of connected Article objects and prints them out.- Parameters:
article- the root of the article 'tree'depth- the current tree depthps- the PrintStream to use- Since:
- 3.4
-
printThread
public static void printThread(Article article, java.io.PrintStream ps)
Recursive method that traverses a pre-threaded graph (or tree) of connected Article objects and prints them out.- Parameters:
article- the root of the article 'tree'ps- the PrintStream to use- Since:
- 3.4
-
addHeaderField
@Deprecated public void addHeaderField(java.lang.String name, java.lang.String val)Deprecated.Does nothing.- Parameters:
name- Ignored.val- Ignored.
-
addReference
public void addReference(java.lang.String msgId)
Adds a message-id to the list of messages that this message references (i.e. replies to)- Parameters:
msgId- the message id to add
-
flushSubjectCache
private void flushSubjectCache()
-
getArticleId
public java.lang.String getArticleId()
Gets the article ID.- Returns:
- the article ID.
-
getArticleNumber
@Deprecated public int getArticleNumber()
Deprecated.Gets the article number.- Returns:
- the article number.
-
getArticleNumberLong
public long getArticleNumberLong()
Gets the article number.- Returns:
- the article number.
-
getChild
public Article getChild()
Gets the child article.- Returns:
- the child article.
- Since:
- 3.12.0
-
getDate
public java.lang.String getDate()
Gets the article date header.- Returns:
- the article date header.
-
getFrom
public java.lang.String getFrom()
Gets the article from header.- Returns:
- the article from header.
-
getNext
public Article getNext()
Gets the next article.- Returns:
- the next article.
- Since:
- 3.12.0
-
getReferences
public java.lang.String[] getReferences()
Returns the MessageId references as an array of Strings- Returns:
- an array of message-ids
-
getSubject
public java.lang.String getSubject()
Gets the article subject.- Returns:
- the article subject.
-
isDummy
public boolean isDummy()
Description copied from interface:ThreadableTests whether this is a dummy instance.- Specified by:
isDummyin interfaceThreadable<Article>- Returns:
- whether this is a dummy instance.
-
makeDummy
public Article makeDummy()
Description copied from interface:ThreadableCreates a dummy instance.- Specified by:
makeDummyin interfaceThreadable<Article>- Returns:
- a dummy instance.
-
messageThreadId
public java.lang.String messageThreadId()
Description copied from interface:ThreadableGets an ID.- Specified by:
messageThreadIdin interfaceThreadable<Article>- Returns:
- an ID.
-
messageThreadReferences
public java.lang.String[] messageThreadReferences()
Description copied from interface:ThreadableGets reference strings.- Specified by:
messageThreadReferencesin interfaceThreadable<Article>- Returns:
- reference strings.
-
setArticleId
public void setArticleId(java.lang.String string)
Sets the article ID.- Parameters:
string- the article ID.
-
setArticleNumber
@Deprecated public void setArticleNumber(int articleNumber)
Deprecated.Sets the article number.- Parameters:
articleNumber- the article number.
-
setArticleNumber
public void setArticleNumber(long articleNumber)
Sets the article number.- Parameters:
articleNumber- the article number.
-
setChild
public void setChild(Article child)
Description copied from interface:ThreadableSets the child instance.- Specified by:
setChildin interfaceThreadable<Article>- Parameters:
child- the child instance.
-
setDate
public void setDate(java.lang.String date)
Sets the article date header.- Parameters:
date- the article date header.
-
setFrom
public void setFrom(java.lang.String from)
Sets the article from header.- Parameters:
from- the article from header.
-
setNext
public void setNext(Article next)
Description copied from interface:ThreadableSets the next instance.- Specified by:
setNextin interfaceThreadable<Article>- Parameters:
next- the next instance.
-
setSubject
public void setSubject(java.lang.String subject)
Sets the article subject.- Parameters:
subject- the article subject.
-
simplifiedSubject
public java.lang.String simplifiedSubject()
Description copied from interface:ThreadableGets the simplified subject.- Specified by:
simplifiedSubjectin interfaceThreadable<Article>- Returns:
- the simplified subject.
-
simplifySubject
private void simplifySubject()
Attempts to parse the subject line for some typical reply signatures, and strip them out
-
subjectIsReply
public boolean subjectIsReply()
Description copied from interface:ThreadableTests whether this is a reply.- Specified by:
subjectIsReplyin interfaceThreadable<Article>- Returns:
- whether this is a reply.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-