首页>代码>java swing开发的socket远程控制开关机服务>/shutdown-client/src/cn/verp/model/DataPack.java
package cn.verp.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 *数据传输模型
 */
public class DataPack implements Serializable{
	private static final long serialVersionUID = -7655686876333083004L;
	//
	public static final int LOGIN = 1;
	public static final int CLIENT_MESSAGE = 2;
	public static final int CLOSE_CLIENT = 3;
	public static final int STARTUP = 11;
	public static final int SHUTDOWN = 12;
	public static final int REBOOT = 13;
	public static final int REMOTE = 14;
	public static final int SENDFILE = 15;
	public static final int SENDCMD = 100;
	//
	public static final String KEY_USERNAME = "username";
	public static final String KEY_USERTOKEN = "usertoken";
	public static final String KEY_CLIENTIP = "clientIP";
	public static final String KEY_CLIENTPORT = "clientPort";
	public static final String KEY_CLIENTMAC = "clientMac";
	public static final String KEY_DESMAC = "desMac";
	public static final String KEY_CLIENTUPTIME = "clientUptime";
	public static final String KEY_SERVERMSG = "serverMsg";
	
	//指令类型
	private int type;
	
	//传输数据
	private Map<String, Object> data = new HashMap<String, Object>();
	
	
	public DataPack(){}
	public DataPack(String msg){
		this.putMsg(msg);
		this.type = 0;
	}
	public DataPack(String msg, int type){
		this.putMsg(msg);
		this.type = type;
	}
	
	
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public Object getData() {
		return data;
	}
	public void put(String key, Object value){
		this.data.put(key, value);
	}
	public void putMsg(String msg){
		this.data.put(KEY_SERVERMSG, msg);
	}
	
	public int getInt(String key){
		return Integer.parseInt( data.get(key).toString() );
	}
	public String getStr(String key){
		return data.get(key).toString();
	}
	public String getMsg(){
		return data.get(KEY_SERVERMSG).toString();
	}
	public Object get(String key){
		return data.get(key);
	}
	
}
最近下载更多
微笑刺客  LV15 2023年1月13日
ewan007  LV29 2022年4月24日
露无畏  LV12 2022年4月18日
tangjj7260  LV18 2021年12月10日
一个好人520  LV10 2021年9月29日
675104182  LV14 2020年9月22日
huzh035  LV3 2020年2月19日
子不语103  LV7 2020年1月19日
pipulu  LV1 2019年9月24日
adminroot777  LV8 2019年9月23日
最近浏览更多
uid0901  LV2 4月2日
痴汉hug个人民 2023年2月21日
暂无贡献等级
微笑刺客  LV15 2023年1月13日
taoyi123  LV17 2022年12月29日
aixiao5213  LV1 2022年12月28日
炫瓶百事可乐  LV1 2022年12月1日
ewan007  LV29 2022年4月24日
1265260263  LV4 2022年4月8日
17842711  LV1 2022年3月27日
npc也有忧伤  LV3 2022年3月19日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友