| 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; | 
|     } | 
| } |