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