查看本类的 API文档回源码主页即时通讯网 - 即时通讯开发者社区!
1   /*
2    * Copyright 2015 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a 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
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.buffer;
17  
18  /**
19   * {@link DuplicatedByteBuf} implementation that can do optimizations because it knows the duplicated buffer
20   * is of type {@link AbstractByteBuf}.
21   */
22  final class DuplicatedAbstractByteBuf extends DuplicatedByteBuf {
23      DuplicatedAbstractByteBuf(AbstractByteBuf buffer) {
24          super(buffer);
25      }
26  
27      @Override
28      public AbstractByteBuf unwrap() {
29          return (AbstractByteBuf) super.unwrap();
30      }
31  
32      @Override
33      protected byte _getByte(int index) {
34          return unwrap()._getByte(index);
35      }
36  
37      @Override
38      protected short _getShort(int index) {
39          return unwrap()._getShort(index);
40      }
41  
42      @Override
43      protected int _getUnsignedMedium(int index) {
44          return unwrap()._getUnsignedMedium(index);
45      }
46  
47      @Override
48      protected int _getInt(int index) {
49          return unwrap()._getInt(index);
50      }
51  
52      @Override
53      protected long _getLong(int index) {
54          return unwrap()._getLong(index);
55      }
56  
57      @Override
58      protected void _setByte(int index, int value) {
59          unwrap()._setByte(index, value);
60      }
61  
62      @Override
63      protected void _setShort(int index, int value) {
64          unwrap()._setShort(index, value);
65      }
66  
67      @Override
68      protected void _setMedium(int index, int value) {
69          unwrap()._setMedium(index, value);
70      }
71  
72      @Override
73      protected void _setInt(int index, int value) {
74          unwrap()._setInt(index, value);
75      }
76  
77      @Override
78      protected void _setLong(int index, long value) {
79          unwrap()._setLong(index, value);
80      }
81  
82  }