1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.commons.compress.archivers.tar;
20
21 import java.util.Objects;
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 public final class TarArchiveStructSparse {
38 private final long offset;
39 private final long numbytes;
40
41 public TarArchiveStructSparse(final long offset, final long numbytes) {
42 if (offset < 0) {
43 throw new IllegalArgumentException("offset must not be negative");
44 }
45 if (numbytes < 0) {
46 throw new IllegalArgumentException("numbytes must not be negative");
47 }
48 this.offset = offset;
49 this.numbytes = numbytes;
50 }
51
52 @Override
53 public boolean equals(final Object o) {
54 if (this == o) {
55 return true;
56 }
57 if (o == null || getClass() != o.getClass()) {
58 return false;
59 }
60 final TarArchiveStructSparse that = (TarArchiveStructSparse) o;
61 return offset == that.offset && numbytes == that.numbytes;
62 }
63
64 public long getNumbytes() {
65 return numbytes;
66 }
67
68 public long getOffset() {
69 return offset;
70 }
71
72 @Override
73 public int hashCode() {
74 return Objects.hash(offset, numbytes);
75 }
76
77 @Override
78 public String toString() {
79 return "TarArchiveStructSparse{" + "offset=" + offset + ", numbytes=" + numbytes + '}';
80 }
81 }