Package org.jdrupes.httpcodec
Class Decoder.Result<R extends MessageHeader>
java.lang.Object
org.jdrupes.httpcodec.Codec.Result
org.jdrupes.httpcodec.Decoder.Result<R>
- Type Parameters:
R
- the type of the optionally generated response message
- Direct Known Subclasses:
HttpDecoder.Result
,WsDecoder.Result
- Enclosing interface:
- Decoder<T extends MessageHeader,
R extends MessageHeader>
The result from decoding.
In addition to the common codec result, this includes the information wheteher a complete message header has been received and it can include a response that is to be sent back to the sender in order to fulfill the requirements of the protocol. As the decoder can (obviously) not sent back this response by itself, it is included in the result.
The class is declared abstract to promote the usage of the factory method.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Decoder.Result.Factory<R extends MessageHeader>
The Factory for (extended) results. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
boolean
Returns true if the message header has been decoded completely during the decoder invocation that returned this result and is now available.boolean
If the result includes a response (seeresponse()
) and this method returns true then no further processing of the received data is required.response()
Returns the response if a response exists.toString()
Methods inherited from class org.jdrupes.httpcodec.Codec.Result
closeConnection, isOverflow, isUnderflow
-
Constructor Details
-
Result
protected Result(boolean overflow, boolean underflow, boolean closeConnection, boolean headerCompleted, R response, boolean responseOnly) Creates a new result.- Parameters:
overflow
- true if the data didn’t fit in the out bufferunderflow
- true if more data is expectedcloseConnection
- true if the connection should be closedheaderCompleted
- true if the header has completely been decodedresponse
- a response to send due to an errorresponseOnly
- if the result includes a response this flag indicates that no further processing besides sending the response is required
-
-
Method Details
-
isHeaderCompleted
Returns true if the message header has been decoded completely during the decoder invocation that returned this result and is now available.Note that not only the header may heve been decoded, but that the output buffer may also already contain decoded data.
- Returns:
- the result
-
response
Returns the response if a response exists.A response in the decoder result indicates that some information must be signaled back to the sender.
- Returns:
- the response
-
isResponseOnly
If the result includes a response (seeresponse()
) and this method returns true then no further processing of the received data is required.After sending the response data, the decode method should be invoked again with the same parameters.
- Returns:
- the result
-
hashCode
- Overrides:
hashCode
in classCodec.Result
-
equals
- Overrides:
equals
in classCodec.Result
-
toString
- Overrides:
toString
in classCodec.Result
-