📄 submit.java
字号:
String paramString8, String paramString9, int paramInt6,
int paramInt7, int paramInt8, int paramInt9, int paramInt10,
int paramInt11, byte[] paramArrayOfByte)
throws spApi.SGIP_Exception {
super(paramLong);
this.NodeID = paramLong;
this.SPNumber = paramString1;
this.ChargeNumber = paramString2;
this.UserCount = 0;
for (int i = 0; i < paramString3.length(); ++i) {
int j = paramString3.charAt(i);
if ((j != 44) && (((j < 48) || (j > 57))))
throw new spApi.SGIP_Exception("Invalid Mobile Number");
if (j == 44)
this.UserCount += 1;
}
this.UserCount += 1;
if (this.UserCount > 100)
throw new spApi.SGIP_Exception("Too many users!");
this.usernumber = new String[this.UserCount];
int k = 0;
int l = 0;
for (int i = 0; i < this.UserCount - 1; ++i) {
k = l;
l = paramString3.indexOf(44, l + 1);
this.usernumber[i] = paramString3.substring(k, l);
++l;
}
this.usernumber[(this.UserCount - 1)] = paramString3.substring(l,
paramString3.length());
this.CorpId = paramString4;
this.ServiceType = paramString5;
this.FeeType = paramInt2;
this.FeeValue = paramString6;
this.GivenValue = paramString7;
this.AgentFlag = paramInt3;
this.MOrelatetoMTFlag = paramInt4;
this.Priority = paramInt5;
this.ExpireTime = paramString8;
this.ScheduleTime = paramString9;
this.ReportFlag = paramInt6;
this.TP_pid = paramInt7;
this.TP_udhi = paramInt8;
this.MessageCoding = paramInt9;
this.MessageType = paramInt10;
this.ContentLength = paramInt11;
this.BinContent = new byte[paramInt11];
SGIP_Command.BytesCopy(paramArrayOfByte, this.BinContent, 0,
this.ContentLength - 1, 0);
}
private void SetMsgBody() throws spApi.SGIP_Exception {
byte[] arrayOfByte1 = null;
try {
if (this.MessageCoding == 15) {
arrayOfByte1 = this.MessageContent.getBytes("GBK");
this.ContentLength = arrayOfByte1.length;
} else {
this.ContentLength = this.MessageContent.length();
}
} catch (Exception localException) {
System.out.println("chinese code error:"
+ localException.toString());
}
this.TotalLength = (143 + 21 * this.UserCount + this.ContentLength);
this.head.setTotalLength(this.TotalLength);
this.head.setCommandID(3);
this.head.setSeq_1(SGIP_Command.seq.getGlobalSeq_1());
this.head.setSeq_2(SGIP_Command.seq.getGlobalSeq_2());
this.head.setSeq_3(SGIP_Command.seq.getGlobalSeq_3());
this.bodybytes = new byte[this.TotalLength - 20];
byte[] arrayOfByte2 = new byte[21];
if (this.SPNumber.length() > 21)
throw new spApi.SGIP_Exception("SPNumber Longer than 21 bytes:"
+ this.SPNumber);
arrayOfByte2=SPNumber.getBytes();
// System.out.println(SPNumber.length());
SGIP_Command.BytesCopy(arrayOfByte2, this.bodybytes, 0, SPNumber.length()-1, 0);
arrayOfByte2 = new byte[21];
if (this.ChargeNumber.length() > 21)
throw new spApi.SGIP_Exception("ChargeNumber longer than 21 bytes:"
+ this.ChargeNumber);
arrayOfByte2=ChargeNumber.getBytes();
// System.out.println(arrayOfByte2);
// System.out.println("No1-->"+bodybytes[bodybytes.length-1]+"\n"+arrayOfByte2[arrayOfByte2.length-1]);
SGIP_Command.BytesCopy(arrayOfByte2, this.bodybytes, 0, ChargeNumber.length()-1, 21);
System.out.println("No2-->"+bodybytes[bodybytes.length-1]+"\n"+arrayOfByte2[arrayOfByte2.length-1]);
this.bodybytes[42] = (byte) this.UserCount;
// System.out.println(this.UserCount);
int i = 43;
for (int j = 0; j < this.UserCount; ++j) {
arrayOfByte2 = new byte[21];
String str = new String(this.usernumber[j]);
// System.out.println(str.length());
if (str.length() > 21)
throw new spApi.SGIP_Exception(
"UserNumber longer than 21 bytes:" + str);
arrayOfByte2=str.getBytes();
// System.out.println(arrayOfByte2.toString());
// System.out.println(arrayOfByte2.length);
SGIP_Command.BytesCopy(arrayOfByte2, this.bodybytes, 0, str.length()-1, i);
i += 21;
}
arrayOfByte2 = new byte[7];
// System.out.println(CorpId.length());
if (this.CorpId.length() > 7)
throw new spApi.SGIP_Exception("CorpId longer than 5 bytes:"
+ this.CorpId);
arrayOfByte2=this.CorpId.getBytes();
// System.out.println(arrayOfByte2.toString());
SGIP_Command.BytesCopy(arrayOfByte2, this.bodybytes, 0, CorpId.length()-1, i);
i += 5;
arrayOfByte2 = new byte[10];
// System.out.println("<><>"+ServiceType.length()+"<><><><><><><><>"+ServiceType.toString());
if (this.ServiceType.length() > 10)
throw new spApi.SGIP_Exception("ServiceType longer than 10 bytes:"
+ this.ServiceType);
arrayOfByte2=ServiceType.getBytes();
// System.out.println(arrayOfByte2.length);
// System.out.println(arrayOfByte2.toString());
SGIP_Command.BytesCopy(arrayOfByte2, this.bodybytes, 0,ServiceType.length()-1, i);
i += 10;
this.bodybytes[i] = (byte) this.FeeType;
++i;
arrayOfByte2 = new byte[6];
if (this.FeeValue.length() > 6)
throw new spApi.SGIP_Exception("FeeValue longer than 6 bytes:"
+ this.FeeValue);
arrayOfByte2=this.FeeValue.getBytes();
// System.out.println(arrayOfByte2.toString());
// System.out.println(arrayOfByte2.length);
SGIP_Command.BytesCopy(arrayOfByte2, this.bodybytes, 0, FeeValue.length()-1, i);
i += 6;
arrayOfByte2 = new byte[6];
if (this.GivenValue.length() > 6)
throw new spApi.SGIP_Exception("GivenValue longer than 6 bytes:"
+ this.GivenValue);
arrayOfByte2=this.GivenValue.getBytes();
System.out.println(arrayOfByte2.length+"<><><><><>"+arrayOfByte2.toString());
SGIP_Command.BytesCopy(arrayOfByte2, this.bodybytes, 0, GivenValue.length()-1, i);
i += 6;
this.bodybytes[i] = (byte) this.AgentFlag;
// System.out.println(AgentFlag+"<><><><><><><>");
// System.out.println(bodybytes[i]+"?????????/");
++i;
this.bodybytes[i] = (byte) this.MOrelatetoMTFlag;
// System.out.println(bodybytes[i]+"?????????/");
++i;
this.bodybytes[i] = (byte) this.Priority;
// System.out.println(bodybytes[i]+"?????????/");
++i;
arrayOfByte2 = new byte[16];
if (this.ExpireTime.length() > 16)
throw new spApi.SGIP_Exception("EXpireTime longer than 16 bytes:"
+ this.ExpireTime);
arrayOfByte2=this.ExpireTime.getBytes();
// System.out.println(ExpireTime.length()+"<><><><><><>"+ExpireTime.toString());
SGIP_Command.BytesCopy(arrayOfByte2, this.bodybytes, 0, 5, i);
i += 16;
arrayOfByte2 = new byte[16];
if (this.ScheduleTime.length() > 16)
throw new spApi.SGIP_Exception("ScheduleTime longer than 16 bytes:"
+ this.ScheduleTime);
arrayOfByte2=this.ScheduleTime.getBytes();
// System.out.println(ScheduleTime.length()+"<><><><><><>"+ScheduleTime.toString());
SGIP_Command.BytesCopy(arrayOfByte2, this.bodybytes, 0, 4, i);
i += 16;
this.bodybytes[i] = (byte) this.ReportFlag;
// System.out.println(bodybytes[i]+"?????????/");
++i;
this.bodybytes[i] = (byte) this.TP_pid;
// System.out.println(bodybytes[i]+"?????????/");
++i;
this.bodybytes[i] = (byte) this.TP_udhi;
// System.out.println(bodybytes[i]+"?????????/");
++i;
this.bodybytes[i] = (byte) this.MessageCoding;
// System.out.println(bodybytes[i]+"?????????/");
++i;
this.bodybytes[i] = (byte) this.MessageType;
// System.out.println(bodybytes[i]+"?????????/");
++i;
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(this.ContentLength),
this.bodybytes, 0, 3, i);
i += 4;
System.out.println(this.MessageCoding);
if (this.MessageCoding == 15)
SGIP_Command.BytesCopy(arrayOfByte1, this.bodybytes, 0,
this.ContentLength - 1, i);
else
arrayOfByte1=this.MessageContent.getBytes();
}
private void SetBinBody() throws spApi.SGIP_Exception {
this.TotalLength = (143 + 21 * this.UserCount + this.ContentLength);
if (SGIP_Command.seq == null) {
SGIP_Command.seq = new Seq();
SGIP_Command.seq.setNodeId(this.NodeID);
Seq.computeSequence();
}
this.head.setTotalLength(this.TotalLength);
this.head.setCommandID(3);
this.head.setSeq_1(SGIP_Command.seq.getGlobalSeq_1());
this.head.setSeq_2(SGIP_Command.seq.getGlobalSeq_2());
this.head.setSeq_3(SGIP_Command.seq.getGlobalSeq_3());
this.bodybytes = new byte[this.TotalLength - 20];
byte[] arrayOfByte = new byte[21];
if (this.SPNumber.length() > 21)
throw new spApi.SGIP_Exception("SPNumber Longer than 21 bytes:"
+ this.SPNumber);
arrayOfByte=this.SPNumber.getBytes();
SGIP_Command.BytesCopy(arrayOfByte, this.bodybytes, 0, SPNumber.length()-1, 0);
arrayOfByte = new byte[21];
if (this.ChargeNumber.length() > 21)
throw new spApi.SGIP_Exception("ChargeNumber longer than 21 bytes:"
+ this.ChargeNumber);
arrayOfByte=this.ChargeNumber.getBytes();
SGIP_Command.BytesCopy(arrayOfByte, this.bodybytes, 0, ChargeNumber.length()-1, 21);
this.bodybytes[42] = (byte) this.UserCount;
int i = 43;
for (int j = 0; j < this.UserCount; ++j) {
arrayOfByte = new byte[21];
String str = new String(this.usernumber[j]);
if (str.length() > 21)
throw new spApi.SGIP_Exception(
"UserNumber longer than 21 bytes:" + str);
arrayOfByte=str.getBytes();
SGIP_Command.BytesCopy(arrayOfByte, this.bodybytes, 0, str.length()-1, i);
i += 21;
}
arrayOfByte = new byte[5];
if (this.CorpId.length() > 5)
throw new spApi.SGIP_Exception("CorpId longer than 5 bytes:"
+ this.CorpId);
arrayOfByte=this.CorpId.getBytes();
SGIP_Command.BytesCopy(arrayOfByte, this.bodybytes, 0, CorpId.length()-1, i);
i += 5;
arrayOfByte = new byte[10];
if (this.ServiceType.length() > 10)
throw new spApi.SGIP_Exception("ServiceType longer than 10 bytes:"
+ this.ServiceType);
this.ServiceType.getBytes(0, this.ServiceType.length(), arrayOfByte, 0);
SGIP_Command.BytesCopy(arrayOfByte, this.bodybytes, 0, 9, i);
i += 10;
this.bodybytes[i] = (byte) this.FeeType;
++i;
arrayOfByte = new byte[6];
if (this.FeeValue.length() > 6)
throw new spApi.SGIP_Exception("FeeValue longer than 6 bytes:"
+ this.FeeValue);
this.FeeValue.getBytes(0, this.FeeValue.length(), arrayOfByte, 0);
SGIP_Command.BytesCopy(arrayOfByte, this.bodybytes, 0, 5, i);
i += 6;
arrayOfByte = new byte[6];
if (this.GivenValue.length() > 6)
throw new spApi.SGIP_Exception("GivenValue longer than 6 bytes:"
+ this.GivenValue);
this.GivenValue.getBytes(0, this.GivenValue.length(), arrayOfByte, 0);
SGIP_Command.BytesCopy(arrayOfByte, this.bodybytes, 0, 5, i);
i += 6;
this.bodybytes[i] = (byte) this.AgentFlag;
++i;
this.bodybytes[i] = (byte) this.MOrelatetoMTFlag;
++i;
this.bodybytes[i] = (byte) this.Priority;
++i;
arrayOfByte = new byte[16];
if (this.ExpireTime.length() > 16)
throw new spApi.SGIP_Exception("EXpireTime longer than 16 bytes:"
+ this.ExpireTime);
this.ExpireTime.getBytes(0, this.ExpireTime.length(), arrayOfByte, 0);
SGIP_Command.BytesCopy(arrayOfByte, this.bodybytes, 0, 15, i);
i += 16;
arrayOfByte = new byte[16];
if (this.ScheduleTime.length() > 16)
throw new spApi.SGIP_Exception("ScheduleTime longer than 16 bytes:"
+ this.ScheduleTime);
this.ScheduleTime.getBytes(0, this.ScheduleTime.length(), arrayOfByte,
0);
SGIP_Command.BytesCopy(arrayOfByte, this.bodybytes, 0, 15, i);
i += 16;
this.bodybytes[i] = (byte) this.ReportFlag;
++i;
this.bodybytes[i] = (byte) this.TP_pid;
++i;
this.bodybytes[i] = (byte) this.TP_udhi;
++i;
this.bodybytes[i] = (byte) this.MessageCoding;
++i;
this.bodybytes[i] = (byte) this.MessageType;
++i;
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(this.ContentLength),
this.bodybytes, 0, 3, i);
i += 4;
SGIP_Command.BytesCopy(this.BinContent, this.bodybytes, 0,
this.ContentLength - 1, i);
}
public int write(OutputStream paramOutputStream) {
try {
if (this.MessageCoding == 4)
SetBinBody();
else
SetMsgBody();
super.write(paramOutputStream);
return 0;
} catch (Exception localException) {
System.out.println(localException.toString());
}
return -1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -