?? msgqueryringgrouprsp.java
字號:
/**
*
*/
package com.aceway.vas.sjcraw.cbgp201.crm.rgm;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
import com.aceway.vas.sjcraw.cbgp201.Msg;
import com.aceway.vas.sjcraw.cbgp201.common.DataFormat;
/**
* @標(biāo)題: 華為彩鈴平臺接口規(guī)范
* @說明:
* @版權(quán): Copyright(c) 2007
* @公司: 北京漢銘信通科技有限公司
* @部門: 增值業(yè)務(wù)部
* @作者: 武達(dá)
* @Jun 6, 2007
*/
public class MsgQueryRingGroupRsp extends Msg {
private final int LEN_PRE_PHONE=22;
/*
Startnum 4 Integer 起始記錄數(shù)
Curnum 4 Integer 本次返回記錄數(shù)
Allnum 4 Integer 記錄總數(shù)
*/
private int startNum;
private int curNum;
private int allNum;
private Map<Integer, RingGroup>map = new HashMap<Integer, RingGroup>();
private class RingGroup{
/*
RingGroupID(1) 2 Integer 鈴音組ID
RingGroupLabel(1) 20 String 鈴音組標(biāo)簽(名稱)
*/
public int ringGroupId;
public String ringGroupLabel;
}
/**
* @param bytes
*/
public MsgQueryRingGroupRsp(byte[] bytes) {
super(bytes);
ByteBuffer buff = super.getBodyBuffer();
this.startNum = buff.getInt();
this.curNum = buff.getInt();
this.allNum = buff.getInt();
buff = buff.slice();
byte[] msgPhone = new byte[buff.capacity()];
if (buff.capacity()%this.LEN_PRE_PHONE==0 && buff.capacity()/this.LEN_PRE_PHONE==this.curNum){
for (int i=0; i<this.curNum; i++){
byte[] temp = new byte[LEN_PRE_PHONE];
System.arraycopy(msgPhone, i*LEN_PRE_PHONE, temp, 0, temp.length);
RingGroup phone = new RingGroup();
try {
phone.ringGroupId = DataFormat.bytes2int(new byte[]{0, 0, temp[1], temp[2]});
phone.ringGroupLabel = new String(temp, 2, 20, "gbk");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
this.map.put(i, phone);
}
}else {
System.err.print("消息體不正確");
return;
}
}
public int getAllNum() {
return this.allNum;
}
public int getCurNum() {
return this.curNum;
}
public int getStartNum() {
return this.startNum;
}
public int getRingGroupId(int position) {
RingGroup phone = (RingGroup)map.get(position);
return phone.ringGroupId;
}
public String getRingGroupLabel(int position) {
RingGroup phone = (RingGroup)map.get(position);
return phone.ringGroupLabel;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -