?? msghead.java
字號(hào):
package spApi;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
public class MsgHead
{
public byte[] Head;
private int TotalLength;
private int CommandID;
private long Seq_1;
private int Seq_2;
private int Seq_3;
private byte[] tempbytes;
public MsgHead(byte[] paramArrayOfByte)
{
int i = 0;
this.Head = new byte[20];
for (i = 0; i < 20; ++i) {
this.Head[i] = paramArrayOfByte[i];
}
this.TotalLength = SGIP_Command.Bytes4ToInt(this.Head);
this.tempbytes =new byte[] { this.Head[4], this.Head[5], this.Head[6], this.Head[7] };
this.CommandID = SGIP_Command.Bytes4ToInt(this.tempbytes);
tempbytes =new byte[] { Head[8], Head[9], Head[10], Head[11] };
this.Seq_1 = SGIP_Command.Bytes4ToLong(this.tempbytes);
this.tempbytes = new byte[]{ this.Head[12], this.Head[13], this.Head[14], this.Head[15] };
this.Seq_2 = SGIP_Command.Bytes4ToInt(this.tempbytes);
this.tempbytes = new byte[]{ this.Head[16], this.Head[17], this.Head[18], this.Head[19] };
this.Seq_3 = SGIP_Command.Bytes4ToInt(this.tempbytes);
}
public MsgHead() {
this.Head = new byte[20];
}
public MsgHead(int paramInt1, int paramInt2, long paramLong, int paramInt3, int paramInt4)
{
int i = 0;
this.Head = new byte[20];
this.TotalLength = paramInt1;
this.CommandID = paramInt2;
this.Seq_1 = paramLong;
this.Seq_2 = paramInt3;
this.Seq_3 = paramInt4;
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(paramInt1), this.Head, 0, 3, 0);
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(paramInt2), this.Head, 0, 3, 4);
SGIP_Command.BytesCopy(SGIP_Command.LongToBytes4(paramLong), this.Head, 0, 3, 8);
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(paramInt3), this.Head, 0, 3, 12);
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(paramInt4), this.Head, 0, 3, 16);
}
public void setTotalLength(int paramInt)
{
this.TotalLength = paramInt;
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(paramInt), this.Head, 0, 3, 0);
}
public void setCommandID(int paramInt)
{
this.CommandID = paramInt;
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(paramInt), this.Head, 0, 3, 4);
}
public void setSeq_1(long paramLong)
{
this.Seq_1 = paramLong;
SGIP_Command.BytesCopy(SGIP_Command.LongToBytes4(paramLong), this.Head, 0, 3, 8);
}
public void setSeq_2(int paramInt)
{
this.Seq_2 = paramInt;
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(paramInt), this.Head, 0, 3, 12);
}
public void setSeq_3(int paramInt)
{
this.Seq_3 = paramInt;
SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(paramInt), this.Head, 0, 3, 16);
}
public int getTotalLength()
{
return this.TotalLength;
}
public int getCommandID()
{
return this.CommandID;
}
public long getSeq_1()
{
return this.Seq_1;
}
public int getSeq_2()
{
return this.Seq_2;
}
public int getSeq_3()
{
return this.Seq_3;
}
public int write(OutputStream paramOutputStream)
{
int i = 0;
try {
paramOutputStream.write(this.Head);
} catch (Exception localException) {
System.out.println(localException.toString());
return -1;
}
return 0;
}
public int read(InputStream paramInputStream)
{
byte[] arrayOfByte = new byte[4];
try {
paramInputStream.read(arrayOfByte);
SGIP_Command.BytesCopy(arrayOfByte, this.Head, 0, 3, 0);
this.TotalLength = SGIP_Command.Bytes4ToInt(arrayOfByte);
paramInputStream.read(arrayOfByte);
SGIP_Command.BytesCopy(arrayOfByte, this.Head, 0, 3, 4);
this.CommandID = SGIP_Command.Bytes4ToInt(arrayOfByte);
paramInputStream.read(arrayOfByte);
SGIP_Command.BytesCopy(arrayOfByte, this.Head, 0, 3, 8);
this.Seq_1 = SGIP_Command.Bytes4ToLong(arrayOfByte);
paramInputStream.read(arrayOfByte);
SGIP_Command.BytesCopy(arrayOfByte, this.Head, 0, 3, 12);
this.Seq_2 = SGIP_Command.Bytes4ToInt(arrayOfByte);
paramInputStream.read(arrayOfByte);
SGIP_Command.BytesCopy(arrayOfByte, this.Head, 0, 3, 16);
this.Seq_3 = SGIP_Command.Bytes4ToInt(arrayOfByte);
} catch (Exception localException) {
System.out.println(localException.toString());
return -1;
}
return 0;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -