View Javadoc
1   /*
2    * Copyright 2013 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.handler.codec.memcache;
17  
18  import io.netty.buffer.ByteBuf;
19  import io.netty.buffer.Unpooled;
20  import io.netty.handler.codec.DecoderResult;
21  
22  /**
23   * The {@link MemcacheContent} which signals the end of the content batch.
24   * <p/>
25   * Note that by design, even when no content is emitted by the protocol, an
26   * empty {@link LastMemcacheContent} is issued to make the upstream parsing
27   * easier.
28   */
29  public interface LastMemcacheContent extends MemcacheContent {
30  
31      LastMemcacheContent EMPTY_LAST_CONTENT = new LastMemcacheContent() {
32  
33          @Override
34          public LastMemcacheContent copy() {
35              return EMPTY_LAST_CONTENT;
36          }
37  
38          @Override
39          public LastMemcacheContent retain(int increment) {
40              return this;
41          }
42  
43          @Override
44          public LastMemcacheContent retain() {
45              return this;
46          }
47  
48          @Override
49          public LastMemcacheContent touch() {
50              return this;
51          }
52  
53          @Override
54          public LastMemcacheContent touch(Object hint) {
55              return this;
56          }
57  
58          @Override
59          public LastMemcacheContent duplicate() {
60              return this;
61          }
62  
63          @Override
64          public ByteBuf content() {
65              return Unpooled.EMPTY_BUFFER;
66          }
67  
68          @Override
69          public DecoderResult decoderResult() {
70              return DecoderResult.SUCCESS;
71          }
72  
73          @Override
74          public void setDecoderResult(DecoderResult result) {
75              throw new UnsupportedOperationException("read only");
76          }
77  
78          @Override
79          public int refCnt() {
80              return 1;
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      LastMemcacheContent copy();
96  
97      @Override
98      LastMemcacheContent retain(int increment);
99  
100     @Override
101     LastMemcacheContent retain();
102 
103     @Override
104     LastMemcacheContent touch();
105 
106     @Override
107     LastMemcacheContent touch(Object hint);
108 
109     @Override
110     LastMemcacheContent duplicate();
111 }