|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.forum.nntp.NNTPResponseBuffer
public class NNTPResponseBuffer
A simple tool for building dynamic responses.
NNTP responses have an integer response code, a line of text describing the response, and possibly continuation text that is terminated by a '.'.
Field Summary |
---|
Fields inherited from interface com.jivesoftware.forum.nntp.NNTPResponse |
---|
DOT_TERMINATOR, ENDLINE |
Constructor Summary | |
---|---|
NNTPResponseBuffer(Connection connection,
int val)
Create a simple NNTP response with the given response value. |
|
NNTPResponseBuffer(Connection connection,
int val,
java.lang.String text,
boolean continued)
Create a simple NNTP response with the given response value and the response text on the first line of the response. |
Method Summary | |
---|---|
NNTPResponseBuffer |
append(java.lang.String text)
Append the given text to the response. |
NNTPResponseBuffer |
appendBulkText(java.lang.String text)
Append a large quantity of text to the response buffer. |
void |
appendLine(java.lang.String text)
Append the given text followed by an NNTP line end CR-LF pair. |
NNTPResponseBuffer |
appendParameter(java.lang.String text)
Append a space (' ') followed by the given text to the response. |
NNTPResponseBuffer |
appendXParameter(java.lang.String text)
Append a tab ('\t') followed by the given text to the response. |
NNTPResponseBuffer |
close()
Closes the response buffer and prevents any further appends to occur. |
void |
endLine()
Append an NNTP line end CR-LF pair. |
void |
flush()
|
int |
getValue()
Returns the int value associated with the response. |
void |
send(Connection con)
Sends the response. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NNTPResponseBuffer(Connection connection, int val) throws java.io.IOException
Create a simple NNTP response with the given response value.
The response will be terminated with a trailing '.' if it contains more than one line of text.
val
- the NNTP response codeconnection
- the connection.
java.io.IOException
- if initial writes to the buffer for opening response
line fails.public NNTPResponseBuffer(Connection connection, int val, java.lang.String text, boolean continued) throws java.io.IOException
Create a simple NNTP response with the given response value and the response text on the first line of the response.
connection
- the connection to write data to.val
- The response codetext
- The first line response text or null to append it latercontinued
- True if a trailing '.' should be forced onto
the end of the message. If the value is false, a trailing '.'
will still be added if the response has more than one line.
java.io.IOException
- if initial writes to the buffer for opening response
line fails.Method Detail |
---|
public int getValue()
NNTPResponse
getValue
in interface NNTPResponse
public void send(Connection con) throws java.io.IOException
NNTPResponse
Sends the response.
send
in interface NNTPResponse
java.io.IOException
public void flush() throws java.io.IOException
java.io.IOException
public NNTPResponseBuffer close() throws java.io.IOException
java.io.IOException
- if writes to the buffer for closing response fails.public NNTPResponseBuffer append(java.lang.String text) throws java.io.IOException
Append the given text to the response.
The method allows method chaining by returning the response for further appends (e.g. response.appendParameter("bob").appendParameter("sally");).
text
- The text to add (null adds nothing)
java.io.IOException
- if writes to the buffer fails due to underlying connection errors.public NNTPResponseBuffer appendParameter(java.lang.String text) throws java.io.IOException
Append a space (' ') followed by the given text to the response.
Many NNTP responses will contain several space separated parameters on a single line. This convenience method allows the addition of these parameters.
The method allows method chaining by returning the response for further appends (e.g. response.appendParameter("bob").appendParameter("sally");).
text
- The text to add (null adds the space but nothing else)
java.io.IOException
- if writes to the buffer fails due to underlying connection errors.public NNTPResponseBuffer appendXParameter(java.lang.String text) throws java.io.IOException
Append a tab ('\t') followed by the given text to the response.
Many X NNTP extension responses will contain several tab separated parameters on a single line. This convenience method allows the addition of these parameters.
The method allows method chaining by returning the response for further appends (e.g. response.appendParameter("bob").appendParameter("sally");).
text
- The text to add (null adds the space but nothing else)
java.io.IOException
- if writes to the buffer fails due to underlying connection errors.public void endLine() throws java.io.IOException
Append an NNTP line end CR-LF pair.
java.io.IOException
- if writes to the buffer fails due to underlying connection errors.public void appendLine(java.lang.String text) throws java.io.IOException
Append the given text followed by an NNTP line end CR-LF pair.
text
- The text to append (or null to just add an end line)
java.io.IOException
- if writes to the buffer fails due to underlying connection errors.public NNTPResponseBuffer appendBulkText(java.lang.String text) throws java.io.IOException
text
- The text to add to the response buffer
java.io.IOException
- if writes to the buffer fails due to underlying connection errors.
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |