phsexit.java

来自「JAVA实现的短信网关程序」· Java 代码 · 共 61 行

JAVA
61
字号
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 PHSExit
    extends PHSRequest {
  static final int COMMAND_ID = 6;
  static final int lenMessageBody = 0;

  public PHSExit(PHSIO cmppio) throws PHSException {
    super(cmppio);
    if (getOffset() != getLength()) {
      throw new PHSException("CMPPTerminate: no end !");
    }
    else {
      return;
    }
  }

  public PHSExit(PHSMessage msg) throws PHSException {

    setPacketOffset(msg.getPacketOffset());
    setPacketBytes(msg.getPacketBytes());
    setCommandId(msg.getCommandId());
    setSequenceId(msg.getSequenceId());
    setTotalLength(msg.getTotalLength());
    if (getOffset() != getLength()) {
      throw new PHSException("no end !");
    }
    else {
      return;
    }
  }

  public PHSExit() throws PHSException {
    super(6);
  }

  public PHSExit(int SequenceId) throws PHSException {
    super(6, SequenceId);
  }

  public void encodePacket(PHSIO cmppio) throws PHSException {
    if (getLength() != 0) {
      throw new PHSException("encodePacket : invalid packet length !");
    }
    else {
      super.encodePacket(cmppio);
      return;
    }
  }

}

⌨️ 快捷键说明

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