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.
The formatted lines are returned in memory, the formatter does not depend
on any specific IO mechanism.
Instances of this interface are expected to be stateless and thread-safe.
| Modifier and Type | Field and Description |
|---|---|
| public static final BasicLineFormatter | DEFAULT
A default instance of this class, for use as default or fallback. |
| public static final BasicLineFormatter |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public CharArrayBuffer | appendProtocolVersion(final CharArrayBuffer
a buffer to which to append, or buffer, final ProtocolVersion nullthe protocol version to format version)Implements org. |
| protected void | doFormatHeader(final CharArrayBuffer
the empty buffer into which to format,
never buffer, final Header nullthe header to format, never header)nullActually formats a header. |
| protected void | doFormatRequestLine(final CharArrayBuffer
the empty buffer into which to format,
never buffer, final RequestLine nullthe request line to format, never reqline)nullActually formats a request line. |
| protected void | doFormatStatusLine(final CharArrayBuffer
the empty buffer into which to format,
never buffer, final StatusLine nullthe status line to format, never statline)nullActually formats a status line. |
| protected int | Returns: the estimated length of the formatted protocol version, in charactersthe protocol version to format, or version)nullGuesses the length of a formatted protocol version. |
| public static String | Returns: the formatted headerthe header to format header, final LineFormatter the formatter to use, or
formatter)null for the
defaultFormats a header. |
| public CharArrayBuffer | formatHeader(final CharArrayBuffer
a buffer available for formatting, or
buffer, final Header null.
The buffer will be cleared before use.the header to format header)Implements org. |
| public static String | Returns: the formatted protocol versionthe protocol version to format version, final LineFormatter the formatter to use, or
formatter)null for the
defaultFormats a protocol version. |
| public static String | Returns: the formatted request linethe request line to format reqline, final LineFormatter the formatter to use, or
formatter)null for the
defaultFormats a request line. |
| public CharArrayBuffer | formatRequestLine(final CharArrayBuffer
a buffer available for formatting, or
buffer, final RequestLine null.
The buffer will be cleared before use.the request line to format reqline)Implements org. |
| public static String | Returns: the formatted status linethe status line to format statline, final LineFormatter the formatter to use, or
formatter)null for the
defaultFormats a status line. |
| public CharArrayBuffer | formatStatusLine(final CharArrayBuffer
a buffer available for formatting, or
buffer, final StatusLine null.
The buffer will be cleared before use.the status line to format statline)Implements org. |
| protected CharArrayBuffer | Returns: the cleared argument buffer if there is one, or a new empty buffer that can be used for formattinga buffer already available, or charBuffer)nullObtains a buffer for formatting. |
| DEFAULT | back to summary |
|---|---|
| public static final BasicLineFormatter DEFAULT
Deprecated (4.3) use A default instance of this class, for use as default or fallback.
Note that | |
| INSTANCE | back to summary |
|---|---|
| public static final BasicLineFormatter INSTANCE | |
| BasicLineFormatter | back to summary |
|---|---|
| public BasicLineFormatter() | |
| appendProtocolVersion | back to summary |
|---|---|
| public CharArrayBuffer appendProtocolVersion(final CharArrayBuffer buffer, final ProtocolVersion version) Implements org. Doc from org. Formats a protocol version.
This method does not follow the general contract for
| |
| doFormatHeader | back to summary |
|---|---|
| protected void doFormatHeader(final CharArrayBuffer buffer, final Header header) Actually formats a header.
Called from
| |
| doFormatRequestLine | back to summary |
|---|---|
| protected void doFormatRequestLine(final CharArrayBuffer buffer, final RequestLine reqline) Actually formats a request line.
Called from
| |
| doFormatStatusLine | back to summary |
|---|---|
| protected void doFormatStatusLine(final CharArrayBuffer buffer, final StatusLine statline) Actually formats a status line.
Called from
| |
| estimateProtocolVersionLen | back to summary |
|---|---|
| protected int estimateProtocolVersionLen(final ProtocolVersion version) Guesses the length of a formatted protocol version. Needed to guess the length of a formatted request or status line.
| |
| formatHeader | back to summary |
|---|---|
| public static String formatHeader(final Header header, final LineFormatter formatter) Formats a header.
| |
| formatHeader | back to summary |
|---|---|
| public CharArrayBuffer formatHeader(final CharArrayBuffer buffer, final Header header) Implements org. Doc from org. Formats a header. Due to header continuation, the result may be multiple lines. In order to generate well-formed HTTP, the lines in the result must be separated by the HTTP line break sequence CR-LF. There is no trailing CR-LF in the result. See the class comment for details about the buffer argument.
| |
| formatProtocolVersion | back to summary |
|---|---|
| public static String formatProtocolVersion(final ProtocolVersion version, final LineFormatter formatter) Formats a protocol version.
| |
| formatRequestLine | back to summary |
|---|---|
| public static String formatRequestLine(final RequestLine reqline, final LineFormatter formatter) Formats a request line.
| |
| formatRequestLine | back to summary |
|---|---|
| public CharArrayBuffer formatRequestLine(final CharArrayBuffer buffer, final RequestLine reqline) Implements org. Doc from org. Formats a request line.
| |
| formatStatusLine | back to summary |
|---|---|
| public static String formatStatusLine(final StatusLine statline, final LineFormatter formatter) Formats a status line.
| |
| formatStatusLine | back to summary |
|---|---|
| public CharArrayBuffer formatStatusLine(final CharArrayBuffer buffer, final StatusLine statline) Implements org. Doc from org. Formats a status line.
| |
| initBuffer | back to summary |
|---|---|
| protected CharArrayBuffer initBuffer(final CharArrayBuffer charBuffer) Obtains a buffer for formatting.
| |