1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.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
45 static final int COMPRESSED_LENGTH_OFFSET = TOKEN_OFFSET + 1;
46 static final int DECOMPRESSED_LENGTH_OFFSET = COMPRESSED_LENGTH_OFFSET + 4;
47 static final int CHECKSUM_OFFSET = DECOMPRESSED_LENGTH_OFFSET + 4;
48
49
50
51
52 static final int COMPRESSION_LEVEL_BASE = 10;
53
54
55
56
57 static final int MIN_BLOCK_SIZE = 64;
58 static final int MAX_BLOCK_SIZE = 1 << COMPRESSION_LEVEL_BASE + 0x0F;
59 static final int DEFAULT_BLOCK_SIZE = 1 << 16;
60
61
62
63
64 static final int BLOCK_TYPE_NON_COMPRESSED = 0x10;
65 static final int BLOCK_TYPE_COMPRESSED = 0x20;
66
67
68
69
70 static final int DEFAULT_SEED = 0x9747b28c;
71
72 private Lz4Constants() { }
73 }