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.UnstableApi;
19
20
21
22
23 @UnstableApi
24 public enum Http2Error {
25 NO_ERROR(0x0),
26 PROTOCOL_ERROR(0x1),
27 INTERNAL_ERROR(0x2),
28 FLOW_CONTROL_ERROR(0x3),
29 SETTINGS_TIMEOUT(0x4),
30 STREAM_CLOSED(0x5),
31 FRAME_SIZE_ERROR(0x6),
32 REFUSED_STREAM(0x7),
33 CANCEL(0x8),
34 COMPRESSION_ERROR(0x9),
35 CONNECT_ERROR(0xA),
36 ENHANCE_YOUR_CALM(0xB),
37 INADEQUATE_SECURITY(0xC),
38 HTTP_1_1_REQUIRED(0xD);
39
40 private final long code;
41 private static final Http2Error[] INT_TO_ENUM_MAP;
42 static {
43 Http2Error[] errors = values();
44 Http2Error[] map = new Http2Error[errors.length];
45 for (Http2Error error : errors) {
46 map[(int) error.code()] = error;
47 }
48 INT_TO_ENUM_MAP = map;
49 }
50
51 Http2Error(long code) {
52 this.code = code;
53 }
54
55
56
57
58 public long code() {
59 return code;
60 }
61
62 public static Http2Error valueOf(long value) {
63 return value >= INT_TO_ENUM_MAP.length || value < 0 ? null : INT_TO_ENUM_MAP[(int) value];
64 }
65 }