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

📄 tailinfo.java

📁 使用华为cmpp2.0网关
💻 JAVA
字号:
package com.hoten.tail;
import java.net.*;
import java.io.*;
/**
 * <p>Title: MOInfo</p>
 * <p>Description:MO消息类主要是封装了一个MO消息,此类中的数据结构跟数据库中
 * 表UI_MO和WS_MO完全一样。此类有两种方法,get和set主要是对里面的属性进行操作。</p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Company:Hoten</p>
 * @version 1.0
 */

public class TailInfo {
    private int port;                  //目标服务器监听端口
    private String hostIP;             //目标IP或名称

    private byte[]  _startFlag;           //开始标志
    private byte[]  _program;           //消息时间
    private byte[] _pType;         //手机号码
    private byte[] _mType;            //消息内容
    private byte[] _msg;             //业务类别 :9555
    private byte[] _endFlag;            //备份是需要的业务类别 :010


    /** 设置_startFlag */
    public void setStartFlag(String startFlag){
      _startFlag = new byte[4];
      System.arraycopy(startFlag.getBytes(),0,_startFlag,0,4);
    }
    /** 设置program */
    public void setProgram(String program){
      _program = new byte[4];
      System.arraycopy(program.getBytes(),0,_program,0,4);
    }
    /** 设置_pType */
    public void setPType(String pType){
      _pType = new byte[1];
      System.arraycopy(pType.getBytes(),0,_pType,0,1);
    }
    /** 设置_mType */
    public void setMType(String mType){
      _mType = new byte[1];
      System.arraycopy(mType.getBytes(),0,_mType,0,1);
    }
    /** 设置_msg */
    public void setMsg(String msg){
      try {
        _msg = msg.getBytes("gb2312");
      }
      catch (Exception ex) {
        _msg = msg.getBytes();
      }
    }
    /** 设置_endFlag */
    public void setEndFlag(String endFlag){
      _endFlag = new byte[4];
      System.arraycopy(endFlag.getBytes(),0,_endFlag,0,4);
    }
    public byte[] getData(){
      byte[] data = new byte[14+_msg.length];
      System.arraycopy(this._startFlag,0,data,0,4);
      System.arraycopy(this._program,0,data,4,4);
      data[8] = _pType[0];
      data[9] = _mType[0];
      System.arraycopy(this._msg,0,data,10,_msg.length);
      System.arraycopy(this._endFlag,0,data,10+_msg.length,4);
      return data;
    }
    public String getHost(){
      return hostIP;
    }
    public int getPort(){
      return port;
    }
    public void setHost(String ip){
      this.hostIP=ip;
    }
    public void setPort(int port){
      this.port=port;
    }

}

⌨️ 快捷键说明

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