traceresp.java
来自「中国移动定位引擎的客户端」· Java 代码 · 共 64 行
JAVA
64 行
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 + =
减小字号Ctrl + -
显示快捷键?