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    *   https://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 retainedDuplicate() {
49              return this;
50          }
51  
52          @Override
53          public LastStompContentSubframe replace(ByteBuf content) {
54              return new DefaultLastStompContentSubframe(content);
55          }
56  
57          @Override
58          public LastStompContentSubframe retain() {
59              return this;
60          }
61  
62          @Override
63          public LastStompContentSubframe retain(int increment) {
64              return this;
65          }
66  
67          @Override
68          public LastStompContentSubframe touch() {
69              return this;
70          }
71  
72          @Override
73          public LastStompContentSubframe touch(Object hint) {
74              return this;
75          }
76  
77          @Override
78          public int refCnt() {
79              return 1;
80          }
81  
82          @Override
83          public boolean release() {
84              return false;
85          }
86  
87          @Override
88          public boolean release(int decrement) {
89              return false;
90          }
91  
92          @Override
93          public DecoderResult decoderResult() {
94              return DecoderResult.SUCCESS;
95          }
96  
97          @Override
98          public void setDecoderResult(DecoderResult result) {
99              throw new UnsupportedOperationException("read only");
100         }
101     };
102 
103     @Override
104     LastStompContentSubframe copy();
105 
106     @Override
107     LastStompContentSubframe duplicate();
108 
109     @Override
110     LastStompContentSubframe retainedDuplicate();
111 
112     @Override
113     LastStompContentSubframe replace(ByteBuf content);
114 
115     @Override
116     LastStompContentSubframe retain();
117 
118     @Override
119     LastStompContentSubframe retain(int increment);
120 
121     @Override
122     LastStompContentSubframe touch();
123 
124     @Override
125     LastStompContentSubframe touch(Object hint);
126 }