1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.handler.codec.http2;
17
18 import io.netty.util.internal.StringUtil;
19
20 import static io.netty.util.internal.ObjectUtil.checkNotNull;
21
22
23
24
25 public final class DefaultHttp2ResetFrame extends AbstractHttp2StreamFrame implements Http2ResetFrame {
26
27 private final long errorCode;
28
29
30
31
32
33
34 public DefaultHttp2ResetFrame(Http2Error error) {
35 errorCode = checkNotNull(error, "error").code();
36 }
37
38
39
40
41
42
43 public DefaultHttp2ResetFrame(long errorCode) {
44 this.errorCode = errorCode;
45 }
46
47 @Override
48 public DefaultHttp2ResetFrame stream(Http2FrameStream stream) {
49 super.stream(stream);
50 return this;
51 }
52
53 @Override
54 public String name() {
55 return "RST_STREAM";
56 }
57
58 @Override
59 public long errorCode() {
60 return errorCode;
61 }
62
63 @Override
64 public String toString() {
65 return StringUtil.simpleClassName(this) + "(stream=" + stream() + ", errorCode=" + errorCode + ')';
66 }
67
68 @Override
69 public boolean equals(Object o) {
70 if (!(o instanceof DefaultHttp2ResetFrame)) {
71 return false;
72 }
73 DefaultHttp2ResetFrame other = (DefaultHttp2ResetFrame) o;
74 return super.equals(o) && errorCode == other.errorCode;
75 }
76
77 @Override
78 public int hashCode() {
79 int hash = super.hashCode();
80 hash = hash * 31 + (int) (errorCode ^ errorCode >>> 32);
81 return hash;
82 }
83 }