|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LineFormatter
Interface for formatting elements of the HEAD section of an HTTP message.
This is the complement to LineParser
.
There are individual methods for formatting a request line, a
status line, or a header line. The formatting does not include the
trailing line break sequence CR-LF.
Instances of this interface are expected to be stateless and thread-safe.
The formatted lines are returned in memory, the formatter does not depend
on any specific IO mechanism.
In order to avoid unnecessary creation of temporary objects,
a buffer can be passed as argument to all formatting methods.
The implementation may or may not actually use that buffer for formatting.
If it is used, the buffer will first be cleared by the
formatXXX
methods.
The argument buffer can always be re-used after the call. The buffer
returned as the result, if it is different from the argument buffer,
MUST NOT be modified.
Method Summary | |
---|---|
CharArrayBuffer |
appendProtocolVersion(CharArrayBuffer buffer,
ProtocolVersion version)
Formats a protocol version. |
CharArrayBuffer |
formatHeader(CharArrayBuffer buffer,
Header header)
Formats a header. |
CharArrayBuffer |
formatRequestLine(CharArrayBuffer buffer,
RequestLine reqline)
Formats a request line. |
CharArrayBuffer |
formatStatusLine(CharArrayBuffer buffer,
StatusLine statline)
Formats a status line. |
Method Detail |
---|
CharArrayBuffer appendProtocolVersion(CharArrayBuffer buffer, ProtocolVersion version)
buffer
arguments.
It does not clear the argument buffer, but appends instead.
The returned buffer can always be modified by the caller.
Because of these differing conventions, it is not named
formatProtocolVersion
.
buffer
- a buffer to which to append, or null
version
- the protocol version to format
buffer
argument is not null
,
the returned buffer is the argument buffer.CharArrayBuffer formatRequestLine(CharArrayBuffer buffer, RequestLine reqline)
buffer
- a buffer available for formatting, or
null
.
The buffer will be cleared before use.reqline
- the request line to format
CharArrayBuffer formatStatusLine(CharArrayBuffer buffer, StatusLine statline)
buffer
- a buffer available for formatting, or
null
.
The buffer will be cleared before use.statline
- the status line to format
ParseException
- in case of a parse errorCharArrayBuffer formatHeader(CharArrayBuffer buffer, Header header)
See the class comment for details about the buffer argument.
buffer
- a buffer available for formatting, or
null
.
The buffer will be cleared before use.header
- the header to format
null
.
The returned buffer may be different from the argument buffer.
ParseException
- in case of a parse error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |