hxb
2022-09-08 2a01ef5e49422cca49bc7476fc1b8be8c8556561
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
53
54
55
56
57
58
59
60
61
62
63
64
package com.hdl.sdk.link.core.bean;
 
 
import com.hdl.sdk.link.common.utils.TextUtils;
import com.hdl.sdk.link.common.utils.gson.GsonConvert;
 
import java.io.Serializable;
 
/**
 * Created by Tong on 2021/9/27.
 */
public class LinkResponse implements Serializable {
 
    private String topic;
    private String data;
    private int length;
    private byte []byteData;
 
    public String getTopic() {
        return topic;
    }
 
    public void setTopic(String topic) {
        this.topic = topic;
    }
 
    public String getData() {
        return data;
    }
 
    public void setByteData(byte []data) {
        this.byteData = data;
        this.data = new String(data);
        this.length=data.length;
    }
 
    public byte []getByteData() {
        return byteData;
    }
 
    public void setData(String data) {
        this.data = data;
        if (!TextUtils.isEmpty(data)) {
            this.byteData = data.getBytes();
            setLength(data.length());
        } else {
            setLength(0);
        }
 
    }
 
    public int getLength() {
        return length;
    }
 
    private void setLength(int length) {
        this.length = length;
    }
 
    @Override
    public String toString() {
        return GsonConvert.getGson().toJson(this);
    }
}