View Javadoc
1   /*
2    * Copyright 2014 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License, version 2.0 (the
5    * "License"); you may not use this file except in compliance with the License. You may obtain a
6    * copy of the License at:
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software distributed under the License
11   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing permissions and limitations under
13   * the License.
14   */
15  
16  package io.netty.handler.codec.http2;
17  
18  import io.netty.buffer.ByteBuf;
19  
20  /**
21   * Encodes {@link Http2Headers} into HPACK-encoded headers blocks.
22   */
23  public interface Http2HeadersEncoder {
24      /**
25       * Configuration related elements for the {@link Http2HeadersEncoder} interface
26       */
27      interface Configuration {
28          /**
29           * Access the Http2HeaderTable for this {@link Http2HeadersEncoder}
30           */
31          Http2HeaderTable headerTable();
32      }
33  
34      /**
35       * Encodes the given headers and writes the output headers block to the given output buffer.
36       *
37       * @param headers the headers to be encoded.
38       * @param buffer the buffer to receive the encoded headers.
39       */
40      void encodeHeaders(Http2Headers headers, ByteBuf buffer) throws Http2Exception;
41  
42      /**
43       * Get the {@link Configuration} for this {@link Http2HeadersEncoder}
44       */
45      Configuration configuration();
46  }