Class Codec.Result

java.lang.Object
org.jdrupes.httpcodec.Codec.Result
Direct Known Subclasses:
Decoder.Result, HttpEncoder.Result, WsEncoder.Result
Enclosing interface:
Codec

public abstract static class Codec.Result extends Object
The common properties of the result types returned by the various codecs.

Derived classes add their respective additional values.

The class is declared abstract to promote the usage of the factory method.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
    A base class for a factory that creates results.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Result(boolean overflow, boolean underflow, boolean closeConnection)
    Creates a new result with the given values.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates that the connection to the receiver of the response must be closed after sending any remaining data in the out buffer.
    boolean
     
    int
     
    boolean
    Indicates that the data didn’t fit in the out buffer.
    boolean
    Indicates that more data is needed to complete the encoding or decoding of the entity.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Result

      protected Result(boolean overflow, boolean underflow, boolean closeConnection)
      Creates a new result with the given values.
      Parameters:
      overflow - true if the data didn’t fit in the out buffer
      underflow - true if more data is expected
      closeConnection - true if the connection should be closed
  • Method Details

    • isOverflow

      public boolean isOverflow()
      Indicates that the data didn’t fit in the out buffer.

      The encoding method that has returned this result should be re-invoked with the same parameters except for a new (or cleared) output buffer.

      Returns:
      true if overflow occurred
      See Also:
    • isUnderflow

      public boolean isUnderflow()
      Indicates that more data is needed to complete the encoding or decoding of the entity.

      Codecs may report an underflow condition even if there is still data available in the input buffer in order to report some special condition in an extended result type. In this case, the encode or decode method should be reinvoked with the same parameters after handling the special condition that has been reported.

      If underflow is reported and the input buffer is empty, the encode or decode method should be reinvoked with the same parameters except for an input buffer with additional information.

      A result with both overflow and underflow set to false indicates the completion of the encoding or decoding process of the entity. In this case, the input buffer may still contain data that belongs to the next entity that is to be encoded or decoded.

      Returns:
      true if underflow occurred
    • closeConnection

      public boolean closeConnection()
      Indicates that the connection to the receiver of the response must be closed after sending any remaining data in the out buffer.
      Returns:
      the value
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object