📄 tracesmreq.java
字号:
package ffcs.lbp.trace;
import java.nio.ByteBuffer;
import ffcs.lbp.ProtocolException;
import ffcs.lbp.le.message.LeMessage;
public class TraceSmReq extends TraceMsg {
public TraceSmReq(){
super(TRACE_SM_REQ);
}
private String msisdnSrc;//主叫号码
private String msisdnDest;//被叫号码
private int condition1;//条件1(例精确匹配,模糊匹配)
private int condition2;//条件2(mapkey-参考配置文件)
/**
* 读取协议包的包体
* @param buf ByteBuffer
* @throws MessageParseException
* @return boolean true读成功,false读取失败
*/
public boolean readBody(ByteBuffer buf) throws ProtocolException {
msisdnSrc = super.readCString(buf);
msisdnDest = super.readCString(buf);
condition1 = buf.getInt();
condition2 = buf.getInt();
return true;
}
/**
* 写入协议包的包体
* @param buf ByteBuffer
* @return boolean true写成功,false写失败
*/
public boolean writeBody(ByteBuffer buf) {
super.writeCString(buf,msisdnSrc);
super.writeCString(buf,msisdnDest);
buf.putInt(condition1);
buf.putInt(condition2);
return true;
}
/**
* 得到包体的长度
* @return int
*/
protected int getBodyLength() {
int length = (msisdnSrc==null) ? 0 :msisdnSrc.length();
length += (msisdnDest==null) ? 0 :msisdnDest.length();
length +=8;
length +=2;//两个字段为CString类型 "\0"结尾
return length;
}
public int getPackLength(){
return LeMessage.HEADER_LENGTH+getBodyLength();
}
public int getCondition1() {
return condition1;
}
public void setCondition1(int condition1) {
this.condition1 = condition1;
}
public int getCondition2() {
return condition2;
}
public void setCondition2(int condition2) {
this.condition2 = condition2;
}
public String getMsisdnDest() {
return msisdnDest;
}
public void setMsisdnDest(String msisdnDest) {
this.msisdnDest = msisdnDest;
}
public String getMsisdnSrc() {
return msisdnSrc;
}
public void setMsisdnSrc(String msisdnSrc) {
this.msisdnSrc = msisdnSrc;
}
public String toString() {
StringBuffer sb=new StringBuffer(250);
sb.append(" TraceReq:");
sb.append(super.toString());
sb.append(" 主叫:"+this.msisdnSrc);
sb.append(" 被叫:"+this.msisdnDest);
sb.append(" 条件1:"+this.condition1);
sb.append(" 条件2:"+this.condition2);
return sb.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -