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

📄 cbspayresp.java

📁 WAP服务器
💻 JAVA
字号:
package simulator.wap.message;

import net.smpp.message.SMPPResponse;
import net.smpp.message.SMPPProtocolException;
import net.smpp.util.SMPPIO;

import java.io.OutputStream;

/**
 * 
 * Author: zhouzh
 * Create Time: 2004-7-28 1:11:05
 *
 */

public class CBSPayResp extends SMPPResponse
{
    public CBSPayResp()
    {
        super(CBS_PAY_RESP);
    }

    public CBSPayResp(int seqNum)
    {
        super(CBS_PAY_RESP, seqNum);
    }

    int result;
    int balance;
    String sn;

    public CBSPayResp(CBSPay r)
    {
        super(r);
    }

    public int getBodyLength()
    {
        int len = ((sn != null) ? sn.length()+1 : 1)
              + 1 + 4;
        return len;
    }

    protected void encodeBody(OutputStream out) throws java.io.IOException
    {
        SMPPIO.writeInt(result, 1, out);

        SMPPIO.writeInt(balance, 4, out);

        SMPPIO.writeCString(sn, out);
    }

     public void readBodyFrom(byte[] b, int offset) throws SMPPProtocolException
     {
        result = SMPPIO.bytesToInt(b, offset, 1);
        offset += 1;
        balance = SMPPIO.bytesToInt(b, offset, 4);
        offset += 4;
        sn = SMPPIO.readCString(b, offset);
        offset += sn.length()+1;

     }

    public static final int OP_SUCCESS = 0;
    public static final int OP_ERR_INSUFFICIENT = 1;
    public static final int OP_ERR_NOEXIST =5;

    public static final int OP_ERR_OTHER = 99;

    public int getResult()
    {
        return result;
    }

    public void setResult(int result)
    {
        this.result = result;
    }

    public int getBalance()
    {
        return balance;
    }

    public void setBalance(int balance)
    {
        this.balance = balance;
    }

    public String getSn()
    {
        return sn;
    }

    public void setSn(String sn)
    {
        this.sn = sn;
    }
}

⌨️ 快捷键说明

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