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

📄 traceresp.java

📁 中国移动定位引擎的客户端
💻 JAVA
字号:
package ffcs.lbp.trace;

import java.nio.ByteBuffer;

import ffcs.lbp.MessageParseException;
import ffcs.lbp.ProtocolException;
import ffcs.lbp.le.message.LeMessage;
/*
 * <p>Title: 流程追踪协议解析类</p>
 * <p>Description: 流程追踪请求应答包</p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: 福富软件</p>
 * @author chenxin
 * @version 1.0 $Date 2007-11-02
 */
public abstract class TraceResp extends TraceMsg {
	private int status=0;//状态码0为成功,非0为失败
	
	public TraceResp(int commandID){
		super(commandID);
	}
	
	/**
	 * 读取协议包的包体
	 * @param buf ByteBuffer
	 * @throws MessageParseException
	 * @return boolean true读成功,false读取失败
	 */
	public boolean readBody(ByteBuffer buf) throws ProtocolException {
		status = buf.getInt();
		return false;
	}
	/**
	 * 写入协议包的包体
	 * @param buf ByteBuffer
	 * @return boolean true写成功,false写失败
	 */
	public boolean writeBody(ByteBuffer buf) {
        buf.putInt(status);
		return false;
	}

	protected int getBodyLength() {
		return 4;
	}
	public int getPackLength(){
		return LeMessage.HEADER_LENGTH+getBodyLength();
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	
 	public String toString() {
		StringBuffer sb=new StringBuffer(100);
	    sb.append(super.toString());
		sb.append(" 状态:"+this.status);
		return sb.toString();
	}

}

⌨️ 快捷键说明

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