shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.walker.tcp.msg;
 
import com.walker.tcp.Message;
 
/**
 * 描述:
 * @author 时克英
 * @date 2020年8月19日 下午11:06:43
 */
 
public abstract class MyAbstractMessage implements Message {
 
    private byte[] feature;
    private int totalSize = 0;
    private boolean encrypt = false;
    private Object encryptType = null;
    private Object protocol = null;
    private Object payload = null;
    
    public void setFeature(byte[] feature) {
        this.feature = feature;
    }
 
    public void setTotalSize(int totalSize) {
        this.totalSize = totalSize;
    }
 
    public void setEncrypt(boolean encrypt) {
        this.encrypt = encrypt;
    }
 
    public void setEncryptType(Object encryptType) {
        this.encryptType = encryptType;
    }
 
    public void setProtocol(Object protocol) {
        this.protocol = protocol;
    }
 
    public void setPayload(Object payload) {
        this.payload = payload;
    }
 
    @Override
    public byte[] getFeature() {
        return this.feature;
    }
 
    @Override
    public int getTotalSize() {
        return this.totalSize;
    }
 
    @Override
    public boolean isEncrypt() {
        return this.encrypt;
    }
 
    @Override
    public Object getEncryptType() {
        return this.encryptType;
    }
 
    @Override
    public Object getProtocol() {
        return this.protocol;
    }
 
    @Override
    public Object getPayload() {
        return this.payload;
    }
    
    /**
     * 解析具体消息内容,由子类实现。
     * @param msg
     */
    protected abstract void parseMessage(byte[] msg);
}