cbsunpayresp.java

来自「WAP服务器」· Java 代码 · 共 81 行

JAVA
81
字号
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:12:37
 *
 */

public class CBSUnpayResp extends SMPPResponse
{
    public CBSUnpayResp()
    {
        super(CBS_UNPAY_RESP);
    }

    public CBSUnpayResp(int seqNum)
    {
        super(CBS_UNPAY_RESP, seqNum);
    }

    int result;
    int balance;

    public CBSUnpayResp(CBSUnpay r)
    {
        super(r);
    }

    public int getBodyLength()
    {
        return 5;
    }

    protected void encodeBody(OutputStream out)
            throws java.io.IOException
    {
        SMPPIO.writeInt(result, 1, out);
        SMPPIO.writeInt(balance, 4, 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;
    }


    public static final int OP_SUCCESS = 0;
    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;
    }
}

⌨️ 快捷键说明

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