?? smppdecoder.java
字號(hào):
package projectsmpp;public class SmppDecoder extends Decoder { public SmppDecoder(byte abyte0[]) { super(abyte0); }//----------------------------------------------------------------------- //對(duì)收到的smppHeader進(jìn)行解碼//--------------------------------------------------------------------- public SmppHeader smppHeader(SmppHeader smppheader) throws decoderException { if(smppheader == null) smppheader = new SmppHeader(); String s = null; try { s = "command_length."; smppheader.command_length = super.int32(); s = "command_id."; smppheader.command_id = super.int32(); s = "command_status."; smppheader.command_status = super.int32(); s = "sequence_no."; smppheader.sequence_no = super.int32(); } catch(decoderException decoderexception) { if(s != null) throw new decoderException(decoderexception + s); else throw decoderexception; } return smppheader; } public SmppHeader smppHeader() throws decoderException { return smppHeader(null); }//--------------------------------------------------------------------- //對(duì)返回的bind響應(yīng)進(jìn)行解碼//-------------------------------------------------------------------- public Bind bindResponse(Bind binding) throws decoderException { if(binding == null) binding = new Bind(); String s = null; try { s = "system_id."; binding.system_id = asciiz(16); } catch(decoderException decoderexception) { if(s != null) throw new decoderException(decoderexception + s); else throw decoderexception; } return binding; } public Bind bindResponse() throws decoderException { return bindResponse(null); }//---------------------------------------------------------------------- //對(duì)收到的deliver-sm消息進(jìn)行解碼//--------------------------------------------------------------------public DeliverSm deliverSm(DeliverSm submit) throws decoderException { if(submit==null) submit=new DeliverSm(); String s=null; try { s = "service_type."; submit.service_type=asciiz(6); s = "source_address_ton."; submit.source_address_ton=int8(); s = "source_address_npi."; submit.source_address_npi=int8(); s = "source_address."; submit.source_address=asciiz(21); s = "dest_address_ton."; submit.dest_address_ton=int8(); s = "dest_address_npi."; submit.dest_address_npi=int8(); s= "destination_address."; submit.destination_address=asciiz(21); s="esm_class."; submit.esm_class=int8(); s="protocol_id."; submit.protocol_id=int8(); s="priority_flag."; submit.priority_flag=int8(); s="schedule_delivery_time."; submit.schedule_delivery_time=UTC(); s="validaty_period."; submit.validaty_period=UTC(); s="registered_delivery_flag."; submit.registered_delivery_flag=int8(); s="replace_if_present_flag."; submit.replace_if_present_flag=int8(); s="data_coding."; submit.data_coding=int8(); s="sm_default_msg_id."; submit.sm_default_msg_id=int8(); s="sm_length."; submit.sm_length=super.lenfix(int8()); s="short_message_text."; submit.short_message_text = new byte[lenfix(submit.sm_length)]; for(int j = 0; j < lenfix(submit.sm_length); j++) submit.short_message_text[j] = super.int8(); } catch(decoderException decoderexception) { if(s != null) throw new decoderException(decoderexception + s); else throw decoderexception; } return submit; } public DeliverSm deliverSm()throws decoderException { return deliverSm(null); } //------------------------------------------------------------------ //對(duì)提交消息的響應(yīng)進(jìn)行解碼 //------------------------------------------------------------------- public SubmitResp submitResp(SubmitResp submitResp) throws decoderException { if(submitResp==null) submitResp=new SubmitResp(); String s=null; try{ s="message_id."; submitResp.message_id=asciiz(9); } catch(decoderException decoderexception) { if(s != null) throw new decoderException(decoderexception + s); else throw decoderexception; } return submitResp; } public SubmitResp submitResp() throws decoderException { return submitResp(null); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -