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

📄 smsbindresp.java

📁 WAP PUSH后台源码,WAP PUSH后台源码
💻 JAVA
字号:
package com.tssx.ebiz.sgip;

import java.io.*;
/**
 * <p>类名: SMSBindResp</p>
 * <p>功能: 建立一个发送/接受的通道返回</p>
 * <p>版权: Copyright (c) 2002</p>
 * <p>公司: 深讯信科</p>
 * <p>版本: 1.0</p>
 * @程序 xuke
 * @修改纪录
 */
public class SMSBindResp extends SMSData{
     private int result;
     private String reserve;

     public SMSBindResp(){
          super();
     }
     public int getResult() {
             return result;
     }
     public void setResult(int newResult) {
             result = newResult;
     }
     public String getReserve() {
             return reserve;
     }
     public void setReserve(String newReserve) {
             reserve = newReserve;
     }
     public synchronized void read(DataInputStream m_is) throws SgipException,IOException {
          int i=0;
          byte[] head1=new byte[4];
//          m_is.read(head1,0,4);
          head1[0]=m_is.readByte();
          head1[1]=m_is.readByte();
          head1[2]=m_is.readByte();
          head1[3]=m_is.readByte();
          this.messageLength=(head1[0] & 0xff) << 24 | (head1[1] & 0xff) << 16 | (head1[2] & 0xff) << 8 | head1[3] & 0xff;//29

          byte[] head2=new byte[4];
//          m_is.read(head2,4,4);
          head2[0]=m_is.readByte();
          head2[1]=m_is.readByte();
          head2[2]=m_is.readByte();
          head2[3]=m_is.readByte();
          this.commandID=(head2[0] & 0xff) << 24 | (head2[1] & 0xff) << 16 | (head2[2] & 0xff) << 8 | head2[3] & 0xff;
//          if(this.commandID!=CommandID.SGIP_BIND_RESP){
//               throw new SgipException();
//          }

          byte[] head3=new byte[4];
//          m_is.read(head3,8,4);
          head3[0]=m_is.readByte();
          head3[1]=m_is.readByte();
          head3[2]=m_is.readByte();
          head3[3]=m_is.readByte();
          this.seqAddr=(head3[0] & 0xff) << 24 | (head3[1] & 0xff) << 16 | (head3[2] & 0xff) << 8 | head3[3] & 0xff;

          byte[] head4=new byte[4];
//          m_is.read(head4,12,4);
          head4[0]=m_is.readByte();
          head4[1]=m_is.readByte();
          head4[2]=m_is.readByte();
          head4[3]=m_is.readByte();
          this.seqDate=(head4[0] & 0xff) << 24 | (head4[1] & 0xff) << 16 | (head4[2] & 0xff) << 8 | head4[3] & 0xff;

          byte[] head5=new byte[4];
//          m_is.read(head5,16,4);
          head5[0]=m_is.readByte();
          head5[1]=m_is.readByte();
          head5[2]=m_is.readByte();
          head5[3]=m_is.readByte();
          this.sequence=(head5[0] & 0xff) << 24 | (head5[1] & 0xff) << 16 | (head5[2] & 0xff) << 8 | head5[3] & 0xff;
//          byte[] body1=new byte[1];
//          m_is.read(body1,20,1);

          byte body1=m_is.readByte();
          this.result=body1;

          byte[] body2=new byte[8];
//          m_is.read(body2,21,8);
          while(i<body2.length){
               body2[i]=m_is.readByte();
               i++;
          }
          this.reserve=new String(body2);

//          System.out.println("----------bind resp begin----------");
//          System.out.println(head1[0]);
//          System.out.println(head1[1]);
//          System.out.println(head1[2]);
//          System.out.println(head1[3]);
//          System.out.println(head2[0]);
//          System.out.println(head2[1]);
//          System.out.println(head2[2]);
//          System.out.println(head2[3]);
//          System.out.println(head3[0]);
//          System.out.println(head3[1]);
//          System.out.println(head3[2]);
//          System.out.println(head3[3]);
//          System.out.println(head4[0]);
//          System.out.println(head4[1]);
//          System.out.println(head4[2]);
//          System.out.println(head4[3]);
//          System.out.println(head5[0]);
//          System.out.println(head5[1]);
//          System.out.println(head5[2]);
//          System.out.println(head5[3]);
//          System.out.println(body1);
//          System.out.println("----------bind resp begin----------");
//          System.out.println("messageLength:"+messageLength);
//          System.out.println("commandID:"+commandID);
//          System.out.println("seqAddr:"+seqAddr);
//          System.out.println("seqDate:"+seqDate);
//          System.out.println("sequence:"+sequence);
//          System.out.println("result:"+result);
//          System.out.println("reserve:"+reserve);
//          System.out.println("----------bind resp end----------");

     }
     public synchronized void write(DataOutputStream m_os) throws IOException{
          int i=0;
          int j=0;
          this.messageLength=29;
          this.commandID=CommandID.SGIP_BIND_RESP;

          byte b[]=new byte[messageLength];

          /*head*/
          byte[] head1=getInteger4(messageLength);
          byte[] head2=getInteger4(commandID);
          byte[] head3=getInteger4(seqAddr);
          byte[] head4=getInteger4(seqDate);
          byte[] head5=getInteger4(sequence);

          /*body*/
          byte body1=getInteger1(result);
          byte[] body2=getText(8,reserve);
          i=0;
          j=0;
          while(j<head1.length){
               b[i]=head1[j];
               i++;
               j++;
          }
          j=0;
          while(j<head2.length){
               b[i]=head2[j];
               i++;
               j++;
          }
          j=0;
          while(j<head3.length){
               b[i]=head3[j];
               i++;
               j++;
          }
          j=0;
          while(j<head4.length){
               b[i]=head4[j];
               i++;
               j++;
          }
          j=0;
          while(j<head5.length){
               b[i]=head5[j];
               i++;
               j++;
          }
          b[i]=body1;
          i++;
          j=0;
          while(j<body2.length){
               b[i]=body2[j];
               i++;
               j++;
          }
          m_os.write(b);
     }

}

⌨️ 快捷键说明

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