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

📄 sgip_command.java

📁 短信开发汇总
💻 JAVA
字号:
/*    北方交通大学16204宿舍专用Java反编译器 Java204 版本:0.2    *//*            <<<使用前务必请仔细阅读随附警告信息>>>            */// Copyright RainForest 2001.  All rights reserved.pApi:
//               MsgHead, Seq, SubmitResp, Deliver, 
//               Bind, BindResp, Unbind, UnbindResp, 
//               Report, TraceResp, Userrpt

public class SGIP_Command
{// 类成员变量定义域开始  // Java 204 代码风格版本 : 6.0   < 类Fox Lin C++ 风格 >// 类成员变量定义域结束      < 初始化过程祥见构造方法 >// 类成员变量定义域开始

     protected byte bodybytes[];
     protected MsgHead head;
     protected int TotalLength;
     protected static Seq seq = null;
     public static final int LEN_SGIP_HEADER = 20;
     public static final int LEN_SGIP_BIND = 41;
     public static final int LEN_SGIP_BIND_RESP = 9;
     public static final int LEN_SGIP_UNBIND = 0;
     public static final int LEN_SGIP_UNBIND_RESP = 0;
     public static final int LEN_SGIP_SUBMIT = 123;
     public static final int LEN_SGIP_SUBMIT_RESP = 9;
     public static final int LEN_SGIP_DELIVER = 57;
     public static final int LEN_SGIP_DELIVER_RESP = 9;
     public static final int LEN_SGIP_REPORT = 44;
     public static final int LEN_SGIP_REPORT_RESP = 9;
     public static final int LEN_SGIP_USERRPT = 51;
     public static final int LEN_SGIP_USERRPT_RESP = 9;
     public static final int LEN_SGIP_TRACE = 41;
     public static final int LEN_SGIP_TRACE_RESP = 48;
     public static final int LEN_MAX_CONTENT = 160;
     public static final int TIMEOUT = 60000;
     public static final int SUBMIT_OK = 0;
     public static final int SUBMIT_ERROR_STRUCTURE = 1;
     public static final int SUBMIT_ERROR_COMMANDTYPE = 2;
     public static final int SUBMIT_ERROR_SEQ_DUPLICATE = 3;
     public static final int SUBMIT_ERROR_MSG_LENGTH = 4;
     public static final int SUBMIT_ERROR_FEECODE = 5;
     public static final int SUBMIT_ERROR_CONTENT_LENGTH_EXCEED = 6;
     public static final int SUBMIT_ERROR_SERVERID = 7;
     public static final int SUBMIT_ERROR_FLOW_CONTROL = 8;
     public static final int SUBMIT_ERROR_OTHERS = 9;
     public static final int ID_SGIP_BIND = 1;
     public static final int ID_SGIP_BIND_RESP = 0x80000001;
     public static final int ID_SGIP_UNBIND = 2;
     public static final int ID_SGIP_UNBIND_RESP = 0x80000002;
     public static final int ID_SGIP_SUBMIT = 3;
     public static final int ID_SGIP_SUBMIT_RESP = 0x80000003;
     public static final int ID_SGIP_DELIVER = 4;
     public static final int ID_SGIP_DELIVER_RESP = 0x80000004;
     public static final int ID_SGIP_REPORT = 5;
     public static final int ID_SGIP_REPORT_RESP = 0x80000005;
     public static final int ID_SGIP_USERRPT = 17;
     public static final int ID_SGIP_USERRPT_RESP = 0x80000011;
     public static final int ID_SGIP_TRACE = 4096;
     public static final int ID_SGIP_TRACE_RESP = 0x80001000;
     public static final int MSG_TYPE_ASCII = 0;
     public static final int MSG_TYPE_WRITECARD = 3;
     public static final int MSG_TYPE_BINARY = 4;
     public static final int MSG_TYPE_UCS2 = 8;
     public static final int MSG_TYPE_CHINESE = 15;
     public static final int READ_SGIP_INVALID = 0;
     public static final int READ_SGIP_DELIVER = 1;
     public static final int READ_SGIP_REPORT = 2;
     public static final int READ_SGIP_USERRPT = 3;
     public static final int READ_SGIP_UNBIND = 4;

// 类成员变量定义域结束      < 初始化过程祥见构造方法 >

     public SGIP_Command()  // 构造方法 (如有必要,请手工调整该方法)  // 构造方法 (如有必要,请手工调整该方法)
     {
          TotalLength = 0;
          head = new MsgHead();
          if(seq == null)
               seq = new Seq();
     }//构造方法结束 //构造方法结束 

     public SGIP_Command(long l)
     {
          TotalLength = 0;
          head = new MsgHead();
          if(seq == null)
               seq = new Seq();
          seq.setNodeId(l);
     }

     public SGIP_Command(MsgHead msghead)
     {
          TotalLength = 0;
          head = msghead;
          if(seq == null)
               seq = new Seq();
     }

     public SGIP_Command(SGIP_Command sgip_command)
     {
          TotalLength = 0;
          head = sgip_command.head;
          bodybytes = sgip_command.bodybytes;
          TotalLength = sgip_command.TotalLength;
          seq = seq;
     }

     public SGIP_Command(long l, int i, int j, int k, int i1)
     {
          TotalLength = 0;
          if(seq == null)
               seq = new Seq(i, j);
          seq.setNodeId(l);
          TotalLength = 20 + k;
          head = new MsgHead();
          head.setTotalLength(TotalLength);
          head.setCommandID(i1);
          head.setSeq_1(seq.getGlobalSeq_1());
          head.setSeq_2(seq.getGlobalSeq_2());
          head.setSeq_3(seq.getGlobalSeq_3());
          bodybytes = new byte[k];
     }

     public SGIP_Command(MsgHead msghead, int i, int j)
     {
          TotalLength = 0;
          if(seq == null)
               seq = new Seq();
          TotalLength = 20 + i;
          head = new MsgHead();
          head.setTotalLength(TotalLength);
          head.setCommandID(j);
          head.setSeq_1(msghead.getSeq_1());
          head.setSeq_2(msghead.getSeq_2());
          head.setSeq_3(msghead.getSeq_3());
          bodybytes = new byte[i];
     }

     public SGIP_Command(long l, int i, int j)
     {
          TotalLength = 0;
          if(seq == null)
               seq = new Seq();
          seq.setNodeId(l);
          TotalLength = 20 + i;
          head = new MsgHead();
          head.setTotalLength(TotalLength);
          head.setCommandID(j);
          head.setSeq_1(seq.getGlobalSeq_1());
          head.setSeq_2(seq.getGlobalSeq_2());
          head.setSeq_3(seq.getGlobalSeq_3());
          bodybytes = new byte[i];
     }

     public SGIP_Command(int i, int j)
     {
          TotalLength = 0;
          if(seq == null)
               seq = new Seq();
          TotalLength = 20 + i;
          head = new MsgHead();
          head.setTotalLength(TotalLength);
          head.setCommandID(j);
          head.setSeq_1(seq.getGlobalSeq_1());
          head.setSeq_2(seq.getGlobalSeq_2());
          head.setSeq_3(seq.getGlobalSeq_3());
          bodybytes = new byte[i];
     }

     public int write(OutputStream outputstream)
     {
          byte abyte0[] = new byte[TotalLength];
          Class class1 = Seq.seqclass;
          class1;
          JVM INSTR monitorenter ;
          Seq.computeSequence();
          head.setSeq_2(seq.getGlobalSeq_2());
          head.setSeq_3(seq.getGlobalSeq_3());
          class1;
          JVM INSTR monitorexit ;
          break MISSING_BLOCK_LABEL_54;
          Exception exception1;
          exception1;
          class1;
          JVM INSTR monitorexit ;
          throw exception1;
          BytesCopy(head.Head, abyte0, 0, 19, 0);
          BytesCopy(bodybytes, abyte0, 0, TotalLength - 20 - 1, 20);
          outputstream.write(abyte0);
          return 0;
          Exception exception;
          exception;
          System.out.println(exception.toString());
          return -1;
     }// int write 结束// int write 结束

     public SGIP_Command read(InputStream inputstream)
          throws IOException, Exception
     {
          head.read(inputstream);
          readdataintobody(inputstream);
          switch(head.getCommandID())
          {
          case -2147483645: 
               return new SubmitResp(this);

          case 4: //'\004'
               return new Deliver(this);

          case 1: //'\001'
               return new Bind(this);

          case -2147483647: 
               return new BindResp(this);

          case 2: //'\002'
               return new Unbind(this);

          case -2147483646: 
               return new UnbindResp(this);

          case 5: //'\005'
               return new Report(this);

          case -2147479552: 
               return new TraceResp(this);

          case 17: //'\021'
               return new Userrpt(this);

          }// switch 结束// switch 结束
          return null;
     }// throws IOException, Exception 结束// throws IOException, Exception 结束

     private void readdataintobody(InputStream inputstream)
          throws IOException, Exception
     {
          TotalLength = head.getTotalLength();
          bodybytes = new byte[TotalLength - 20];
          inputstream.read(bodybytes);
     }

     public int getTotalLength()
     {
          return head.getTotalLength();
     }

     public long getSeqno_1()
     {
          return head.getSeq_1();
     }

     public int getSeqno_2()
     {
          return head.getSeq_2();
     }

     public int getSeqno_3()
     {
          return head.getSeq_3();
     }

     public MsgHead getMsgHead()
     {
          return head;
     }

     public void setSeqno_1(long l)
     {
          head.setSeq_1(l);
     }

     public int getCommandID()
     {
          return head.getCommandID();
     }

     protected static int ByteToInt(byte byte0)
     {
          return byte0;
     }

     protected static byte IntToByte(int i)
     {
          return (byte)i;
     }

     protected static int BytesToInt(byte abyte0[])
     {
          return ((0xff & abyte0[0]) << 8) + abyte0[1];
     }

     protected static byte[] IntToBytes(int i)
     {
          byte abyte0[] = new byte[2];
          abyte0[1] = (byte)(0xff & i);
          abyte0[0] = (byte)((0xff00 & i) >> 8);
          return abyte0;
     }

     protected static byte[] IntToBytes4(int i)
     {
          byte abyte0[] = new byte[4];
          abyte0[3] = (byte)(0xff & i);
          abyte0[2] = (byte)((0xff00 & i) >> 8);
          abyte0[1] = (byte)((0xff0000 & i) >> 16);
          abyte0[0] = (byte)((0xff000000 & i) >> 24);
          return abyte0;
     }

     protected static byte[] LongToBytes4(long l)
     {
          byte abyte0[] = new byte[4];
          abyte0[3] = (byte)(int)(255L & l);
          abyte0[2] = (byte)(int)((65280L & l) >> 8);
          abyte0[1] = (byte)(int)((0xff0000L & l) >> 16);
          abyte0[0] = (byte)(int)((0xffffffffff000000L & l) >> 24);
          return abyte0;
     }

     protected static void LongToBytes4(long l, byte abyte0[])
     {
          abyte0[3] = (byte)(int)(255L & l);
          abyte0[2] = (byte)(int)((65280L & l) >> 8);
          abyte0[1] = (byte)(int)((0xff0000L & l) >> 16);
          abyte0[0] = (byte)(int)((0xffffffffff000000L & l) >> 24);
     }

     protected static void IntToBytes(int i, byte abyte0[])
     {
          abyte0[1] = (byte)(0xff & i);
          abyte0[0] = (byte)((0xff00 & i) >> 8);
     }

     protected static void IntToBytes4(int i, byte abyte0[])
     {
          abyte0[3] = (byte)(0xff & i);
          abyte0[2] = (byte)((0xff00 & i) >> 8);
          abyte0[1] = (byte)((0xff0000 & i) >> 16);
          abyte0[0] = (byte)(int)((0xffffffffff000000L & (long)i) >> 24);
     }

     protected static int Bytes4ToInt(byte abyte0[])
     {
          return (0xff & abyte0[0]) << 24 | (0xff & abyte0[1]) << 16 | (0xff & abyte0[2]) << 8 | 0xff & abyte0[3];
     }

     protected static long Bytes4ToLong(byte abyte0[])
     {
          return (255L & (long)abyte0[0]) << 24 | (255L & (long)abyte0[1]) << 16 | (255L & (long)abyte0[2]) << 8 | 255L & (long)abyte0[3];
     }

     protected static void BytesCopy(byte abyte0[], byte abyte1[], int i, int j, int k)
     {
          int i1 = 0;
          for(int l = i; l <= j; l++)
          {
               abyte1[k + i1] = abyte0[l];
               i1++;
          }

     }  // Java 204 代码风格版本 : 6.0   < 类Fox Lin C++ 风格 >}//  class SGIP_Command 结束// 主类结束//  class SGIP_Command 结束// 主类结束
/*********提高国人Java水平,从你做起,从我做起,我看不如从Java204做起....*********//*联系我们 :    地址 : 北京市北方交通大学电气99-2班  29号信箱    邮编 : 100044    电话 : 010-63223904 或 13641045686    RFB  : 冯霖    补充 : 我在16204宿舍住 :) *//*谢谢选择RainForest的产品,请多支持我们,我们会把更多更强的BOSS级工具奉献给用户*//*********提高国人Java水平,从你做起,从我做起,我看不如从Java204做起....*********//*联系我们 :    地址 : 北京市北方交通大学电气99-2班  29号信箱    邮编 : 100044    电话 : 010-63223904 或 13641045686    RFB  : 冯霖    补充 : 我在16204宿舍住 :) *//*谢谢选择RainForest的产品,请多支持我们,我们会把更多更强的BOSS级工具奉献给用户*/

⌨️ 快捷键说明

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