1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.handler.codec.http;
17
18 import io.netty.buffer.ByteBuf;
19 import io.netty.util.internal.StringUtil;
20
21
22
23
24 public class DefaultHttpContent extends DefaultHttpObject implements HttpContent {
25
26 private final ByteBuf content;
27
28
29
30
31 public DefaultHttpContent(ByteBuf content) {
32 if (content == null) {
33 throw new NullPointerException("content");
34 }
35 this.content = content;
36 }
37
38 @Override
39 public ByteBuf content() {
40 return content;
41 }
42
43 @Override
44 public HttpContent copy() {
45 return new DefaultHttpContent(content.copy());
46 }
47
48 @Override
49 public HttpContent duplicate() {
50 return new DefaultHttpContent(content.duplicate());
51 }
52
53 @Override
54 public int refCnt() {
55 return content.refCnt();
56 }
57
58 @Override
59 public HttpContent retain() {
60 content.retain();
61 return this;
62 }
63
64 @Override
65 public HttpContent retain(int increment) {
66 content.retain(increment);
67 return this;
68 }
69
70 @Override
71 public boolean release() {
72 return content.release();
73 }
74
75 @Override
76 public boolean release(int decrement) {
77 return content.release(decrement);
78 }
79
80 @Override
81 public String toString() {
82 return StringUtil.simpleClassName(this) +
83 "(data: " + content() + ", decoderResult: " + getDecoderResult() + ')';
84 }
85 }