1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package org.waarp.compress.zstdsafe;
35
36 import java.util.Arrays;
37
38 class FrameHeader {
39 final int headerSize;
40 final int windowSize;
41 final int contentSize;
42 final int dictionaryId;
43 final boolean hasChecksum;
44
45 public FrameHeader(final int headerSize, final int windowSize,
46 final int contentSize, final int dictionaryId,
47 final boolean hasChecksum) {
48 this.headerSize = headerSize;
49 this.windowSize = windowSize;
50 this.contentSize = contentSize;
51 this.dictionaryId = dictionaryId;
52 this.hasChecksum = hasChecksum;
53 }
54
55 @Override
56 public boolean equals(final Object o) {
57 if (this == o) {
58 return true;
59 }
60 if (o == null || getClass() != o.getClass()) {
61 return false;
62 }
63 final FrameHeader that = (FrameHeader) o;
64 return headerSize == that.headerSize && windowSize == that.windowSize &&
65 contentSize == that.contentSize &&
66 dictionaryId == that.dictionaryId && hasChecksum == that.hasChecksum;
67 }
68
69 @Override
70 public int hashCode() {
71 return Arrays.hashCode(new Object[] {
72 headerSize, windowSize, contentSize, dictionaryId, hasChecksum
73 });
74 }
75
76 @Override
77 public String toString() {
78 return new StringBuilder(FrameHeader.class.getSimpleName() + "[").append(
79 "headerSize=").append(headerSize).append(", ").append("windowSize=")
80 .append(
81 windowSize)
82 .append(
83 ", ")
84 .append(
85 "contentSize=")
86 .append(
87 contentSize)
88 .append(
89 ", ")
90 .append(
91 "dictionaryId=")
92 .append(
93 dictionaryId)
94 .append(
95 ", ")
96 .append(
97 "hasChecksum=")
98 .append(
99 hasChecksum)
100 .append(
101 "]")
102 .toString();
103 }
104 }