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

📄 phsmessage.java

📁 JAVA实现的短信网关程序
💻 JAVA
字号:
package sms.PHS;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */
public class PHSMessage
    extends PHSPacket {

  public static final int DELIVER_TYPE_COMMAN_DELIVER = 0;
  public static final int DELIVER_TYPE_REPORT_DELIVER = 1;
  public static final int LEN_MAX_CONTENT = 140;
  public static final int LEN_MAX_CONTENT_ASCII = 160;
  public static final int MAX_DESTUSR_TL = 99;
  public static final int MAX_MSG_LEVEL = 9;
  public static final int MIN_MSG_LEVEL = 0;
  public static final int MSG_TYPE_ASCII = 0;
  public static final int MSG_TYPE_BINARY = 4;
  public static final int MSG_TYPE_CHINESE = 15;
  public static final int MSG_TYPE_UCS2 = 8;
  public static final int MSG_TYPE_WRITECARD = 3;
  private int commandId;
  private static final int lenMessageHeader = 12;
  private int sequenceId;
  private int totalLength;

  public PHSMessage(PHSIO cmppio) throws PHSException {
    super.getPacket(cmppio, 12);
    totalLength = getInteger();
    commandId = getInteger();
    sequenceId = getInteger();
    int i = totalLength - 12;
    if (i > 0) {
      super.getPacket(cmppio, i);
    }
  }

  protected PHSMessage(int i) {
    totalLength = 0;
    commandId = i;
    PHSSeq seq = new PHSSeq();
    sequenceId = seq.getSeq();
  }

  protected PHSMessage(int i, int j) {
    totalLength = 0;
    commandId = i;
    sequenceId = j;
  }

  protected PHSMessage() {
    totalLength = 0;
    commandId = 0;
    sequenceId = 0;
  }

  protected void encodePacket(PHSIO cmppio) throws PHSException {
    totalLength = getLength() + 12;
    insertInteger(sequenceId);
    insertInteger(commandId);
    insertInteger(totalLength);
    super.encodePacket(cmppio);
  }

  public int getCommandId() {
    return commandId;
  }

  public int getSequenceId() {
    return sequenceId;
  }

  public int getTotalLength() {
    return totalLength;
  }

  public void setCommandId(int commandId) {
    this.commandId = commandId;
  }

  public void setSequenceId(int i) {
    sequenceId = i;
  }

  public void setTotalLength(int totalLength) {
    this.totalLength = totalLength;
  }
}

⌨️ 快捷键说明

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