cbsunpay.java

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

JAVA
68
字号
package simulator.wap.message;

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

import java.io.OutputStream;


public class CBSUnpay extends SMPPRequest
{
    public CBSUnpay()
    {
        super(CBS_UNPAY) ;
    }

    public CBSUnpay(int seqNum)
    {
        super(CBS_UNPAY, seqNum);
    }

    String orgSn;
    int result;

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

    protected void encodeBody(OutputStream out) throws java.io.IOException
    {
        SMPPIO.writeCString(orgSn, out);

        SMPPIO.writeInt(result, 1, out);
     }

    public void readBodyFrom(byte[] body, int offset) throws SMPPProtocolException
    {

        orgSn = SMPPIO.readCString(body, offset);
        offset += orgSn.length()+1;

        result = SMPPIO.bytesToInt(body, 1, offset);
        offset+=1;
    }

    public String getOrgSn()
    {
        return orgSn;
    }

    public void setOrgSn(String orgSn)
    {
        this.orgSn = orgSn;
    }

    public int getResult()
    {
        return result;
    }

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

⌨️ 快捷键说明

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