Interface FrameHeaderReader

All Known Implementing Classes:
DataFrameHeaderReader, FixedSizeHeaderReader, SaslNegotiationHeaderReader

public interface FrameHeaderReader
Read headers for a frame. For each frame, the header contains payload size and other metadata.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clear the header and make it available to read a new header.
    boolean
     
    int
    As the thrift sasl specification states, all sasl messages (both for negotiatiing and for sending data) should have a header to indicate the size of the payload.
    boolean
    read(TTransport transport)
    (Nonblocking) Read fields from underlying transport layer.
    byte[]
     
  • Method Details

    • payloadSize

      int payloadSize()
      As the thrift sasl specification states, all sasl messages (both for negotiatiing and for sending data) should have a header to indicate the size of the payload.
      Returns:
      size of the payload.
    • toBytes

      byte[] toBytes()
      Returns:
      The received bytes for the header.
      Throws:
      IllegalStateException - if isComplete returns false.
    • isComplete

      boolean isComplete()
      Returns:
      true if this header has all its fields set.
    • clear

      void clear()
      Clear the header and make it available to read a new header.
    • read

      boolean read(TTransport transport) throws TSaslNegotiationException, TTransportException
      (Nonblocking) Read fields from underlying transport layer.
      Parameters:
      transport - underlying transport.
      Returns:
      true if header is complete after read.
      Throws:
      TSaslNegotiationException - if fail to read a valid header of a sasl negotiation message.
      TTransportException - if io error.