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

📄 cmpp30reader.java

📁 移动CMPP的网关,JAVA又一实现,非常完整的代码.
💻 JAVA
字号:
/*
 * Created on Mar 17, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.grail.comm.cmpp;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

import com.grail.comm.cmpp.message.CMPP30ConnectRepMessage;
import com.grail.comm.cmpp.message.CMPP30DeliverMessage;
import com.grail.comm.cmpp.message.CMPP30SubmitRepMessage;
import com.grail.comm.cmpp.message.CMPPActiveMessage;
import com.grail.comm.cmpp.message.CMPPActiveRepMessage;
import com.grail.comm.cmpp.message.CMPPCancelRepMessage;
import com.grail.comm.cmpp.message.CMPPQueryRepMessage;
import com.grail.comm.cmpp.message.CMPPTerminateMessage;
import com.grail.comm.cmpp.message.CMPPTerminateRepMessage;
import com.grail.comm.core.PMessage;
import com.grail.comm.core.PReader;

/**
 * @author eclipse
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class CMPP30Reader extends PReader
{

    protected DataInputStream in;

    public CMPP30Reader(InputStream is)
    {
        in = new DataInputStream(is);
    }

    public PMessage read()
        throws IOException
    {
        int total_Length = in.readInt();
        int command_Id = in.readInt();
        byte buf[] = new byte[total_Length - 8];
        in.readFully(buf);
        if(command_Id == 0x80000001)
            return new CMPP30ConnectRepMessage(buf);
        if(command_Id == 5)
            return new CMPP30DeliverMessage(buf);
        if(command_Id == 0x80000004)
            return new CMPP30SubmitRepMessage(buf);
        if(command_Id == 0x80000006)
            return new CMPPQueryRepMessage(buf);
        if(command_Id == 0x80000007)
            return new CMPPCancelRepMessage(buf);
        if(command_Id == 0x80000008)
            return new CMPPActiveRepMessage(buf);
        if(command_Id == 8)
            return new CMPPActiveMessage(buf);
        if(command_Id == 2)
            return new CMPPTerminateMessage(buf);
        if(command_Id == 0x80000002)
            return new CMPPTerminateRepMessage(buf);
        else
            return null;
    }
}

⌨️ 快捷键说明

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