示例#1
0
 public byte[] toBytes() {
   byte[] b = new byte[PKT_LEN];
   ByteBuffer bb = ByteBuffer.wrap(b, 0, PKT_LEN);
   bb.order(SMSPApp.smspcfg.bo);
   bb.putInt(pktLen);
   bb.putInt(reqId);
   bb.putInt(seqId);
   return b;
 }
示例#2
0
 public boolean fromBytes(byte[] b, int off, int len) {
   try {
     if (len != PKT_LEN) return false;
     ByteBuffer bb = ByteBuffer.wrap(b, off, len);
     bb.order(SMSPApp.smspcfg.bo);
     pktLen = bb.getInt();
     reqId = bb.getInt();
     seqId = bb.getInt();
     if (pktLen != PKT_LEN) return false;
     if (reqId != REQ_ID) return false;
   } catch (Exception e) {
     e.printStackTrace();
     return false;
   }
   return true;
 }