1 /*******************************************************************************
2 * Copyright (c) 2011 Michael Mimo Moratti.
3 *
4 * Michael Mimo Moratti licenses this file to you under the Apache License, version 2.0
5 * (the "License"); you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 * License for the specific language governing permissions and limitations
12 * under the License.
13 *******************************************************************************/
14 package ch.mimo.netty.handler.codec.icap;
15
16 import org.jboss.netty.buffer.ChannelBuffer;
17 import org.jboss.netty.handler.codec.http.DefaultHttpChunk;
18
19 /**
20 * This is the main Chunk implementation class. It extends @see {@link DefaultHttpChunk} and adds
21 * all necessary methods and members for preview handling.
22 *
23 * @author Michael Mimo Moratti (mimo@mimo.ch)
24 *
25 */
26 public class DefaultIcapChunk extends DefaultHttpChunk implements IcapChunk {
27
28 private boolean preview;
29 private boolean earlyTerminated;
30
31 public DefaultIcapChunk(ChannelBuffer content) {
32 super(content);
33 }
34
35 public void setPreviewChunk(boolean preview) {
36 this.preview = preview;
37 }
38
39 public boolean isPreviewChunk() {
40 return preview;
41 }
42
43 public void setEarlyTermination(boolean earlyTermination) {
44 this.earlyTerminated = earlyTermination;
45 }
46
47 public boolean isEarlyTerminated() {
48 return earlyTerminated;
49 }
50
51 public String toString() {
52 return "DeafultIcapChunk: [isPreviewChunk=" + preview + "] [wasEarlyTerminated=" + earlyTerminated + "] [data=" + getContent().readableBytes() + "]";
53 }
54 }