-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBinaryData.java
More file actions
52 lines (40 loc) · 1.19 KB
/
BinaryData.java
File metadata and controls
52 lines (40 loc) · 1.19 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.coscale.sdk.client.data;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import java.util.Arrays;
import org.apache.commons.codec.binary.Base64;
/**
* For sending binary data to an existing event.
* @author kdegroot
*/
public class BinaryData {
/** The binary data. */
public byte[] bData;
/** The provided filename. */
public String filename;
public BinaryData(byte[] bData, String filename) {
this.bData = bData;
this.filename = filename;
}
public BinaryData() {
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("bData", new String(Base64.decodeBase64(bData))).add("filename", filename).toString();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final BinaryData other = (BinaryData) obj;
return (Arrays.equals(this.bData, other.bData) && this.filename.equals(other.filename));
}
@Override
public int hashCode() {
return Objects.hashCode(bData, filename);
}
}