BaseModel.java
645 Bytes
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
package com.viontech.model;
import io.netty.buffer.ByteBuf;
import lombok.Getter;
import lombok.Setter;
/**
* .
*
* @author 谢明辉
* @date 2020/8/20
*/
@Getter
@Setter
public abstract class BaseModel {
protected Long empty;
protected Long length;
protected Long firstInt;
protected Long secondInt;
protected byte[] data;
/**
* 将byteBuf 转换为 model
*
* @param byteBuf byteBuf
*
* @return model
*/
abstract public BaseModel decode(ByteBuf byteBuf);
/**
* 将 model 转换为 byteBuf
*
* @return byteBuf
*/
abstract public ByteBuf encode();
}