1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty5.handler.codec.compression;
17
18 final class Lz4Constants {
19
20
21
22 static final long MAGIC_NUMBER = (long) 'L' << 56 |
23 (long) 'Z' << 48 |
24 (long) '4' << 40 |
25 (long) 'B' << 32 |
26 'l' << 24 |
27 'o' << 16 |
28 'c' << 8 |
29 'k';
30
31
32
33
34 static final int HEADER_LENGTH = 8 +
35 1 +
36 4 +
37 4 +
38 4;
39
40
41
42
43 static final int TOKEN_OFFSET = 8;
44 static final int COMPRESSED_LENGTH_OFFSET = TOKEN_OFFSET + 1;
45 static final int DECOMPRESSED_LENGTH_OFFSET = COMPRESSED_LENGTH_OFFSET + 4;
46 static final int CHECKSUM_OFFSET = DECOMPRESSED_LENGTH_OFFSET + 4;
47
48
49
50
51 static final int COMPRESSION_LEVEL_BASE = 10;
52
53
54
55
56 static final int MIN_BLOCK_SIZE = 64;
57 static final int MAX_BLOCK_SIZE = 1 << COMPRESSION_LEVEL_BASE + 0x0F;
58 static final int DEFAULT_BLOCK_SIZE = 1 << 16;
59
60
61
62
63 static final int BLOCK_TYPE_NON_COMPRESSED = 0x10;
64 static final int BLOCK_TYPE_COMPRESSED = 0x20;
65
66
67
68
69 static final int DEFAULT_SEED = 0x9747b28c;
70
71 private Lz4Constants() { }
72 }