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    * https://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  package io.netty.handler.codec.http2;
16  
17  import io.netty.buffer.ByteBuf;
18  import io.netty.channel.ChannelHandlerContext;
19  
20  /**
21   * Convenience class that provides no-op implementations for all methods of {@link Http2FrameListener}.
22   */
23  public class Http2FrameAdapter implements Http2FrameListener {
24  
25      @Override
26      public int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding,
27              boolean endOfStream) throws Http2Exception {
28          return data.readableBytes() + padding;
29      }
30  
31      @Override
32      public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers,
33              int padding, boolean endStream) throws Http2Exception {
34      }
35  
36      @Override
37      public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers,
38              int streamDependency, short weight, boolean exclusive, int padding, boolean endStream)
39              throws Http2Exception {
40      }
41  
42      @Override
43      public void onPriorityRead(ChannelHandlerContext ctx, int streamId, int streamDependency,
44              short weight, boolean exclusive) throws Http2Exception {
45      }
46  
47      @Override
48      public void onRstStreamRead(ChannelHandlerContext ctx, int streamId, long errorCode)
49              throws Http2Exception {
50      }
51  
52      @Override
53      public void onSettingsAckRead(ChannelHandlerContext ctx) throws Http2Exception {
54      }
55  
56      @Override
57      public void onSettingsRead(ChannelHandlerContext ctx, Http2Settings settings)
58              throws Http2Exception {
59      }
60  
61      @Override
62      public void onPingRead(ChannelHandlerContext ctx, long data) throws Http2Exception {
63      }
64  
65      @Override
66      public void onPingAckRead(ChannelHandlerContext ctx, long data) throws Http2Exception {
67      }
68  
69      @Override
70      public void onPushPromiseRead(ChannelHandlerContext ctx, int streamId, int promisedStreamId,
71              Http2Headers headers, int padding) throws Http2Exception {
72      }
73  
74      @Override
75      public void onGoAwayRead(ChannelHandlerContext ctx, int lastStreamId, long errorCode,
76              ByteBuf debugData) throws Http2Exception {
77      }
78  
79      @Override
80      public void onWindowUpdateRead(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement)
81                      throws Http2Exception {
82      }
83  
84      @Override
85      public void onUnknownFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags,
86              ByteBuf payload) {
87      }
88  }