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