📄 submit.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: Submit.java
package com.SGIP12.sgipdata;
import java.io.OutputStream;
import java.io.PrintStream;
// Referenced classes of package com.SGIP12.sgipdata:
// SGIP_Command, SGIP_Exception, Seq, MsgHead
public class Submit extends SGIP_Command
{
private int AgentFlag;
private byte BinContent[];
private String ChargeNumber;
private int ContentLength;
private String CorpId;
private String ExpireTime;
private int FeeType;
private String FeeValue;
private String GivenValue;
private int MOrelatetoMTFlag;
private int MessageCoding;
private String MessageContent;
private int MessageLength;
private int MessageType;
private long NodeID;
private int Priority;
private int ReportFlag;
private String Reserve;
private String SPNumber;
private String ScheduleTime;
private String ServiceType;
private int TP_pid;
private int TP_udhi;
private int UserCount;
private String usernumber[];
public Submit(long nodeID, String spNum, String chargeNum, int i, String usrNum, String corpId,
String serviceType, int feeType, String feeValue, String givenValue, int agentFlag, int moRelateToMTFlag, int priority,
String expireTime, String scheduleTime, int reportFlag, int tp_pid, int tp_udhi, int messageCoding, int messageType,
int contentLen, byte messageByte[])
throws SGIP_Exception
{
super(nodeID);
head.setCommandID(3);
NodeID = 0L;
ContentLength = 0;
NodeID = nodeID;
SPNumber = spNum;
ChargeNumber = chargeNum;
UserCount = 0;
for(int i3 = 0; i3 < usrNum.length(); i3++)
{
char c = usrNum.charAt(i3);
if(c != ',' && (c < '0' || c > '9'))
throw new SGIP_Exception("Invalid Mobile Number");
if(c == ',')
UserCount++;
}
UserCount++;
if(UserCount > 100)
throw new SGIP_Exception("Too many users!");
usernumber = new String[UserCount];
boolean flag = false;
int l3 = 0;
for(int j3 = 0; j3 < UserCount - 1; j3++)
{
int k3 = l3;
l3 = usrNum.indexOf(44, l3 + 1);
usernumber[j3] = usrNum.substring(k3, l3);
l3++;
}
usernumber[UserCount - 1] = usrNum.substring(l3, usrNum.length());
CorpId = corpId;
ServiceType = serviceType;
FeeType = feeType;
FeeValue = feeValue;
GivenValue = givenValue;
AgentFlag = agentFlag;
MOrelatetoMTFlag = moRelateToMTFlag;
Priority = priority;
ExpireTime = expireTime;
ScheduleTime = scheduleTime;
ReportFlag = reportFlag;
TP_pid = tp_pid;
TP_udhi = tp_udhi;
MessageCoding = messageCoding;
MessageType = messageType;
ContentLength = contentLen;
BinContent = new byte[contentLen];
SGIP_Command.BytesCopy(messageByte, BinContent, 0, ContentLength - 1, 0);
}
public Submit(long nodeID, String spNum, String chargeNum, int i, String usrNum, String corpId,
String serviceType, int feeType, String feeValue, String givenValue, int agentFlag, int moRelateToMTFlag, int priority,
String expireTime, String scheduleTime, int reportFlag, int tp_pid, int tp_udhi, int messageCoding, int messageType,
int l2, String messageContent)
throws SGIP_Exception
{
super(nodeID);
head.setCommandID(3);
NodeID = 0L;
ContentLength = 0;
NodeID = nodeID;
SPNumber = spNum;
ChargeNumber = chargeNum;
UserCount = 0;
for(int i3 = 0; i3 < usrNum.length(); i3++)
{
char c = usrNum.charAt(i3);
if(c != ',' && (c < '0' || c > '9'))
throw new SGIP_Exception("Invalid Mobile Number");
if(c == ',')
UserCount++;
}
UserCount++;
if(UserCount > 100)
throw new SGIP_Exception("Too many users!");
usernumber = new String[UserCount];
boolean flag = false;
int l3 = 0;
for(int j3 = 0; j3 < UserCount - 1; j3++)
{
int k3 = l3;
l3 = usrNum.indexOf(44, l3 + 1);
usernumber[j3] = usrNum.substring(k3, l3);
l3++;
}
usernumber[UserCount - 1] = usrNum.substring(l3, usrNum.length());
CorpId = corpId;
ServiceType = serviceType;
FeeType = feeType;
FeeValue = feeValue;
GivenValue = givenValue;
AgentFlag = agentFlag;
MOrelatetoMTFlag = moRelateToMTFlag;
Priority = priority;
ExpireTime = expireTime;
ScheduleTime = scheduleTime;
ReportFlag = reportFlag;
TP_pid = tp_pid;
TP_udhi = tp_udhi;
MessageCoding = messageCoding;
MessageType = messageType;
MessageContent = messageContent;
}
public Submit(SGIP_Command sgip_command)
{
super(sgip_command);
NodeID = 0L;
ContentLength = 0;
}
public Submit(long l)
{
super(l);
head.setCommandID(3);
NodeID = 0L;
ContentLength = 0;
NodeID = l;
}
public Submit()
{
head.setCommandID(3);
}
public byte[] HexStringToBytes(String hs)
{
if((hs.indexOf("0x") == 0 || hs.indexOf("0X") == 0) && hs.length() % 2 == 0)
{
hs = hs.substring(2);
int count = hs.length() / 2;
byte res[] = new byte[count];
for(int i = 0; i < count; i++)
{
String temp = hs.substring(0, 2);
byte t = (byte)Integer.parseInt(temp, 16);
res[i] = (byte)(t & 0xff);
res[i] = t;
hs = hs.substring(2);
}
return res;
} else
{
System.out.println("error : 二进制格式有误");
return "".getBytes();
}
}
private void SetBinBody()
throws SGIP_Exception
{
TotalLength = 143 + 21 * UserCount + ContentLength;
if(SGIP_Command.seq == null)
{
SGIP_Command.seq = new Seq();
SGIP_Command.seq.setNodeId(NodeID);
Seq.computeSequence();
}
head.setTotalLength(TotalLength);
head.setCommandID(3);
head.setSeq_1(SGIP_Command.seq.getGlobalSeq_1());
head.setSeq_2(SGIP_Command.seq.getGlobalSeq_2());
head.setSeq_3(SGIP_Command.seq.getGlobalSeq_3());
bodybytes = new byte[TotalLength - 20];
byte abyte0[] = new byte[21];
if(SPNumber.length() > 21)
throw new SGIP_Exception("SPNumber Longer than 21 bytes:" + SPNumber);
SPNumber.getBytes(0, SPNumber.length(), abyte0, 0);
SGIP_Command.BytesCopy(abyte0, bodybytes, 0, 20, 0);
abyte0 = new byte[21];
if(ChargeNumber.length() > 21)
throw new SGIP_Exception("ChargeNumber longer than 21 bytes:" + ChargeNumber);
ChargeNumber.getBytes(0, ChargeNumber.length(), abyte0, 0);
SGIP_Command.BytesCopy(abyte0, bodybytes, 0, 20, 21);
bodybytes[42] = (byte)UserCount;
int i = 43;
for(int j = 0; j < UserCount; j++)
{
abyte0 = new byte[21];
String s = new String(usernumber[j]);
if(s.length() > 21)
throw new SGIP_Exception("UserNumber longer than 21 bytes:" + s);
s.getBytes(0, s.length(), abyte0, 0);
SGIP_Command.BytesCopy(abyte0, bodybytes, 0, 20, i);
i += 21;
}
abyte0 = new byte[5];
if(CorpId.length() > 5)
throw new SGIP_Exception("CorpId longer than 5 bytes:" + CorpId);
CorpId.getBytes(0, CorpId.length(), abyte0, 0);
SGIP_Command.BytesCopy(abyte0, bodybytes, 0, 4, i);
i += 5;
abyte0 = new byte[10];
if(ServiceType.length() > 10)
throw new SGIP_Exception("ServiceType longer than 10 bytes:" + ServiceType);
ServiceType.getBytes(0, ServiceType.length(), abyte0, 0);
SGIP_Command.BytesCopy(abyte0, bodybytes, 0, 9, i);
i += 10;
bodybytes[i] = (byte)FeeType;
i++;
abyte0 = new byte[6];
if(FeeValue.length() > 6)
throw new SGIP_Exception("FeeValue longer than 6 bytes:" + FeeValue);
FeeValue.getBytes(0, FeeValue.length(), abyte0, 0);
SGIP_Command.BytesCopy(abyte0, bodybytes, 0, 5, i);
i += 6;
abyte0 = new byte[6];
if(GivenValue.length() > 6)
throw new SGIP_Exception("GivenValue longer than 6 bytes:" + GivenValue);
GivenValue.getBytes(0, GivenValue.length(), abyte0, 0);
SGIP_Command.BytesCopy(abyte0, bodybytes, 0, 5, i);
i += 6;
bodybytes[i] = (byte)AgentFlag;
i++;
bodybytes[i] = (byte)MOrelatetoMTFlag;
i++;
bodybytes[i] = (byte)Priority;
i++;
abyte0 = new byte[16];
if(ExpireTime.length() > 16)
throw new SGIP_Exception("EXpireTime longer than 16 bytes:" + ExpireTime);
ExpireTime.getBytes(0, ExpireTime.length(), abyte0, 0);
SGIP_Command.BytesCopy(abyte0, bodybytes, 0, 15, i);
i += 16;
abyte0 = new byte[16];
if(ScheduleTime.length() > 16)
{
throw new SGIP_Exception("ScheduleTime longer than 16 bytes:" + ScheduleTime);
} else
{
ScheduleTime.getBytes(0, ScheduleTime.length(), abyte0, 0);
SGIP_Command.BytesCopy(abyte0, bodybytes, 0, 15, i);
i += 16;
bodybytes[i] = (byte)ReportFlag;
i++;
bodybytes[i] = (byte)TP_pid;
i++;
bodybytes[i] = (byte)TP_udhi;
i++;
bodybytes[i] = (byte)MessageCoding;
i++;
bodybytes[i] = (byte)MessageType;
i++;
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(ContentLength), bodybytes, 0, 3, i);
i += 4;
SGIP_Command.BytesCopy(BinContent, bodybytes, 0, ContentLength - 1, i);
return;
}
}
private void SetMsgBody()
throws SGIP_Exception
{
byte abyte0[] = null;
try
{
if(MessageCoding == 15)
{
abyte0 = MessageContent.getBytes("GBK");
ContentLength = abyte0.length;
} else
if(MessageCoding == 8)
{
abyte0 = MessageContent.getBytes("iso-10646-ucs-2");
ContentLength = abyte0.length;
} else
{
abyte0 = MessageContent.getBytes();
ContentLength = abyte0.length;
}
}
catch(Exception exception)
{
System.out.println("message code error:" + exception.toString());
}
TotalLength = 143 + 21 * UserCount + ContentLength;
head.setTotalLength(TotalLength);
head.setCommandID(3);
head.setSeq_1(SGIP_Command.seq.getGlobalSeq_1());
head.setSeq_2(SGIP_Command.seq.getGlobalSeq_2());
head.setSeq_3(SGIP_Command.seq.getGlobalSeq_3());
bodybytes = new byte[TotalLength - 20];
byte abyte1[] = new byte[21];
if(SPNumber.length() > 21)
throw new SGIP_Exception("SPNumber Longer than 21 bytes:" + SPNumber);
SPNumber.getBytes(0, SPNumber.length(), abyte1, 0);
SGIP_Command.BytesCopy(abyte1, bodybytes, 0, 20, 0);
abyte1 = new byte[21];
if(ChargeNumber.length() > 21)
throw new SGIP_Exception("ChargeNumber longer than 21 bytes:" + ChargeNumber);
ChargeNumber.getBytes(0, ChargeNumber.length(), abyte1, 0);
SGIP_Command.BytesCopy(abyte1, bodybytes, 0, 20, 21);
bodybytes[42] = (byte)UserCount;
UserCount = UserCount;
int i = 43;
for(int j = 0; j < UserCount; j++)
{
abyte1 = new byte[21];
String s = new String(usernumber[j]);
if(s.length() > 21)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -