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

📄 msgquerymemringgrouprsp.java

📁 同步接收web services请求
💻 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;

/**
 * @标题: 华为彩铃平台接口规范
 * @说明: 
 * @版权: Copyright(c) 2007 
 * @公司: 北京汉铭信通科技有限公司 
 * @部门: 增值业务部 
 * @作者: 武达
 * @Jun 6, 2007
 */
public class MsgQueryMemRingGroupRsp extends Msg {

	/*
Startnum	4	Integer	起始记录数
Curnum	4	Integer	本次返回记录数
Allnum	4	Integer	记录总数

RingID(1)	12	String	增加的铃音ID
RingName(1)	40	String	铃音名称


		 */
	private final int LEN_PRE_RING = 52;
	
	private class Ring{
		public String ringId;
		public String ringName;

	}
	
	private int startnum;
	private int curnum;
	private int allnum;
	
	private Map<Integer,Ring> map = new HashMap<Integer,Ring>();
	
	
	public MsgQueryMemRingGroupRsp(byte[] bytes){
		super(bytes);
		ByteBuffer buff = super.getBodyBuffer();
		this.startnum = buff.getInt();
		this.curnum = buff.getInt();
		this.allnum = buff.getInt();
		buff = buff.slice();
		byte[] msgRing = new byte[buff.capacity()];
		if (msgRing.length%LEN_PRE_RING == 0 && msgRing.length/LEN_PRE_RING==curnum){
			buff.get(msgRing);
			buff.flip();
			for (int i=0; i<curnum; i++){
				byte[] temp = new byte[LEN_PRE_RING];
				System.arraycopy(msgRing, i*LEN_PRE_RING, temp, 0, temp.length);

				Ring ring = new Ring();
				try {
		            ring.ringId = new String(temp, 0, 12, "gbk");
		            ring.ringName = new String(temp, 16, 40, "gbk");
		            this.map.put(i, ring);
	            } catch (UnsupportedEncodingException e) {
		            e.printStackTrace();
	            }
			}
		}
		else{
			System.err.print("消息体不正确");
			return;
		}

	}

	public int getAllnum() {
    	return this.allnum;
    }

	public int getCurnum() {
    	return this.curnum;
    }

	public int getStartnum() {
    	return this.startnum;
    }


	public String getRingId(int positon) {
		Ring ring = map.get(Integer.valueOf(positon));
    	return ring.ringId;
    }
	public String getRingName(int positon) {
		Ring ring = map.get(Integer.valueOf(positon));
    	return ring.ringName;
    }

	

}

⌨️ 快捷键说明

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