View Javadoc
1   /*
2    * Copyright 2016 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  
16  package io.netty.handler.codec.redis;
17  
18  import io.netty.buffer.ByteBuf;
19  import io.netty.buffer.Unpooled;
20  import io.netty.util.internal.UnstableApi;
21  
22  /**
23   * A last chunk of Bulk Strings.
24   */
25  @UnstableApi
26  public interface LastBulkStringRedisContent extends BulkStringRedisContent {
27  
28      /**
29       * The 'end of content' marker in chunked encoding.
30       */
31      LastBulkStringRedisContent EMPTY_LAST_CONTENT = new LastBulkStringRedisContent() {
32  
33          @Override
34          public ByteBuf content() {
35              return Unpooled.EMPTY_BUFFER;
36          }
37  
38          @Override
39          public LastBulkStringRedisContent copy() {
40              return this;
41          }
42  
43          @Override
44          public LastBulkStringRedisContent duplicate() {
45              return this;
46          }
47  
48          @Override
49          public LastBulkStringRedisContent retainedDuplicate() {
50              return this;
51          }
52  
53          @Override
54          public LastBulkStringRedisContent replace(ByteBuf content) {
55              return new DefaultLastBulkStringRedisContent(content);
56          }
57  
58          @Override
59          public LastBulkStringRedisContent retain(int increment) {
60              return this;
61          }
62  
63          @Override
64          public LastBulkStringRedisContent retain() {
65              return this;
66          }
67  
68          @Override
69          public int refCnt() {
70              return 1;
71          }
72  
73          @Override
74          public LastBulkStringRedisContent touch() {
75              return this;
76          }
77  
78          @Override
79          public LastBulkStringRedisContent touch(Object hint) {
80              return this;
81          }
82  
83          @Override
84          public boolean release() {
85              return false;
86          }
87  
88          @Override
89          public boolean release(int decrement) {
90              return false;
91          }
92      };
93  
94      @Override
95      LastBulkStringRedisContent copy();
96  
97      @Override
98      LastBulkStringRedisContent duplicate();
99  
100     @Override
101     LastBulkStringRedisContent retainedDuplicate();
102 
103     @Override
104     LastBulkStringRedisContent replace(ByteBuf content);
105 
106     @Override
107     LastBulkStringRedisContent retain();
108 
109     @Override
110     LastBulkStringRedisContent retain(int increment);
111 
112     @Override
113     LastBulkStringRedisContent touch();
114 
115     @Override
116     LastBulkStringRedisContent touch(Object hint);
117 }