Class DefaultHttp2FrameReader.HeadersBlockBuilder

java.lang.Object
io.netty.handler.codec.http2.DefaultHttp2FrameReader.HeadersBlockBuilder
Enclosing class:
DefaultHttp2FrameReader

protected class DefaultHttp2FrameReader.HeadersBlockBuilder extends java.lang.Object
Utility class to help with construction of the headers block that may potentially span multiple frames.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private ByteBuf
     
    private int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) final void
    addFragment(ByteBuf fragment, int len, ByteBufAllocator alloc, boolean endOfHeaders)
    Adds a fragment to the block.
    (package private) void
    Closes this builder and frees any resources.
    (package private) Http2Headers
    Builds the headers from the completed headers block.
    private void
    The local header size maximum has been exceeded while accumulating bytes.
    (package private) int
    Return the number of fragments that was used so far.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • headerBlock

      private ByteBuf headerBlock
    • numSmallFragments

      private int numSmallFragments
  • Constructor Details

    • HeadersBlockBuilder

      protected HeadersBlockBuilder()
  • Method Details

    • headerSizeExceeded

      private void headerSizeExceeded() throws Http2Exception
      The local header size maximum has been exceeded while accumulating bytes.
      Throws:
      Http2Exception - A connection error indicating too much data has been received.
    • numSmallFragments

      int numSmallFragments()
      Return the number of fragments that was used so far.
      Returns:
      number of fragments.
    • addFragment

      final void addFragment(ByteBuf fragment, int len, ByteBufAllocator alloc, boolean endOfHeaders) throws Http2Exception
      Adds a fragment to the block.
      Parameters:
      fragment - the fragment of the headers block to be added.
      alloc - allocator for new blocks if needed.
      endOfHeaders - flag indicating whether the current frame is the end of the headers. This is used for an optimization for when the first fragment is the full block. In that case, the buffer is used directly without copying.
      Throws:
      Http2Exception
    • headers

      Http2Headers headers() throws Http2Exception
      Builds the headers from the completed headers block. After this is called, this builder should not be called again.
      Throws:
      Http2Exception
    • close

      void close()
      Closes this builder and frees any resources.