⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helper.java

📁 java版QQ聊天系统
💻 JAVA
字号:
package com.AUG21.ProtocolEncapsulation;

import java.io.*;

public class Helper {

	public byte[] wrap(String input) throws IOException {// 把传进来的字符串加包头,打包
		BussinessOuthelp outhelp = new BussinessOuthelp(300);
		outhelp.writeString(""/*获取账号*/, 6);
		outhelp.writeInt(/*password*/1);
		outhelp.writeString(""/*获取系统时间*/, 14);
		//outhelp.writeString(input, 150);
		outhelp.writeString(Config.END_SYMBOL, 4);
		return outhelp.getBytes();
	}

	public DataMessage unwrap(byte[] buf) throws IOException {// 收到包的解包操作
		BussinessInHelper helper = new BussinessInHelper(buf);
		new NetStruck(helper.getIP(), helper.getInt(), helper.getInt(), helper
				.getLong());

		return new DataMessage(helper.getString(6), helper.getInt(), helper
				.getString(14), helper.getString(150));

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -