zhubaomin
2025-03-25 427d87e5572d72d0e3aaa4364e4f53569222e321
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.dy.rtuMw3rd.tcp4Bjnl.protocol;
 
import com.dy.common.util.ByteUtil;
 
import java.nio.charset.StandardCharsets;
 
/**
 * @Author: liurunyu
 * @Date: 2025/3/18 15:06
 * @Description
 */
public class BjnlCommon {
    public static byte[] wrap(String msg){
        byte[] bs = BjnlProtocol.FrameHeadBytes;
        if(msg != null && msg.length() > 0){
            bs = ByteUtil.bytesMerge(bs, msg.getBytes(StandardCharsets.UTF_8)) ;
        }
        bs = ByteUtil.bytesMerge(bs, BjnlProtocol.FrameTailBytes) ;
        return bs;
    }
}