Java Code Examples for net.fs.utils.ByteIntConvert#toInt()

The following examples show how to use net.fs.utils.ByteIntConvert#toInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CloseMessage_Conn.java    From finalspeed-91yun with GNU General Public License v2.0 5 votes vote down vote up
public CloseMessage_Conn(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
}
 
Example 2
Source File: PingMessage2.java    From finalspeed with GNU General Public License v2.0 5 votes vote down vote up
public PingMessage2(DatagramPacket dp) {
    this.dp = dp;
    dpData = dp.getData();
    ver = ByteShortConvert.toShort(dpData, 0);
    sType = ByteShortConvert.toShort(dpData, 2);
    connectId = ByteIntConvert.toInt(dpData, 4);
    clientId = ByteIntConvert.toInt(dpData, 8);
    pingId = ByteIntConvert.toInt(dpData, 12);
}
 
Example 3
Source File: DataMessage.java    From finalspeed with GNU General Public License v2.0 5 votes vote down vote up
public DataMessage(DatagramPacket dp) {
    this.dp = dp;
    dpData = dp.getData();
    ver = ByteShortConvert.toShort(dpData, 0);
    sType = ByteShortConvert.toShort(dpData, 2);

    connectId = ByteIntConvert.toInt(dpData, 4);
    clientId = ByteIntConvert.toInt(dpData, 8);

    sequence = ByteIntConvert.toInt(dpData, 12);
    length = ByteShortConvert.toShort(dpData, 16);
    timeId = ByteIntConvert.toInt(dpData, 18);
    data = new byte[length];
    System.arraycopy(dpData, 22, data, 0, length);
}
 
Example 4
Source File: CloseMessage_Conn.java    From finalspeed with GNU General Public License v2.0 5 votes vote down vote up
public CloseMessage_Conn(DatagramPacket dp) {
    this.dp = dp;
    dpData = dp.getData();
    ver = ByteShortConvert.toShort(dpData, 0);
    sType = ByteShortConvert.toShort(dpData, 2);
    connectId = ByteIntConvert.toInt(dpData, 4);
    clientId = ByteIntConvert.toInt(dpData, 8);
}
 
Example 5
Source File: PingMessage.java    From finalspeed with GNU General Public License v2.0 5 votes vote down vote up
public PingMessage(DatagramPacket dp) {
    this.dp = dp;
    dpData = dp.getData();
    ver = ByteShortConvert.toShort(dpData, 0);
    sType = ByteShortConvert.toShort(dpData, 2);
    connectId = ByteIntConvert.toInt(dpData, 4);
    clientId = ByteIntConvert.toInt(dpData, 8);
    pingId = ByteIntConvert.toInt(dpData, 12);
    downloadSpeed = ByteShortConvert.toShort(dpData, 16);
    uploadSpeed = ByteShortConvert.toShort(dpData, 18);
}
 
Example 6
Source File: CloseMessage_Stream.java    From finalspeed with GNU General Public License v2.0 5 votes vote down vote up
public CloseMessage_Stream(DatagramPacket dp) {
    this.dp = dp;
    dpData = dp.getData();
    ver = ByteShortConvert.toShort(dpData, 0);
    sType = ByteShortConvert.toShort(dpData, 2);

    connectId = ByteIntConvert.toInt(dpData, 4);
    clientId = ByteIntConvert.toInt(dpData, 8);
    closeOffset = ByteIntConvert.toInt(dpData, 12);
    ////#MLog.println("vCloseMessagebbb"+clientId+"v");
}
 
Example 7
Source File: AckListMessage.java    From finalspeed with GNU General Public License v2.0 5 votes vote down vote up
public AckListMessage(DatagramPacket dp) {
    this.dp = dp;
    dpData = dp.getData();
    ver = ByteShortConvert.toShort(dpData, 0);
    sType = ByteShortConvert.toShort(dpData, 2);
    connectId = ByteIntConvert.toInt(dpData, 4);
    clientId = ByteIntConvert.toInt(dpData, 8);


    lastRead = ByteIntConvert.toInt(dpData, 4 + 8);
    int sum = ByteShortConvert.toShort(dpData, 8 + 8);
    ackList = new ArrayList<>();
    int t;
    for (int i = 0; i < sum; i++) {
        t = 10 + 4 * i;
        int sequence = ByteIntConvert.toInt(dpData, t + 8);
        ackList.add(sequence);
    }
    ////#MLog.println("LLLLLLLLLLLLLL "+dp.getLength()+" "+ackList.size());
    t = 10 + 4 * sum - 4;
    r1 = ByteIntConvert.toInt(dpData, t + 4 + 8);
    s1 = ByteIntConvert.toInt(dpData, t + 8 + 8);

    r2 = ByteIntConvert.toInt(dpData, t + 12 + 8);
    s2 = ByteIntConvert.toInt(dpData, t + 16 + 8);

    r3 = ByteIntConvert.toInt(dpData, t + 20 + 8);
    s3 = ByteIntConvert.toInt(dpData, t + 24 + 8);

    ////#MLog.println("aaaaaaaaa"+r3+"kkkkkkk "+s3);
}
 
Example 8
Source File: PingMessage2.java    From finalspeed-91yun with GNU General Public License v2.0 5 votes vote down vote up
public PingMessage2(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
	pingId=ByteIntConvert.toInt(dpData, 12);
}
 
Example 9
Source File: DataMessage.java    From finalspeed-91yun with GNU General Public License v2.0 5 votes vote down vote up
public DataMessage(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
	
	sequence=ByteIntConvert.toInt(dpData, 12);
	length=ByteShortConvert.toShort(dpData, 16);
	timeId=ByteIntConvert.toInt(dpData, 18);
	data=new byte[length];
	System.arraycopy(dpData, 22, data, 0, length);
}
 
Example 10
Source File: AckListMessage.java    From NSS with Apache License 2.0 5 votes vote down vote up
public AckListMessage(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
	
	
	lastRead=ByteIntConvert.toInt(dpData, 4+8);
	int sum=ByteShortConvert.toShort(dpData, 8+8);
	ackList=new ArrayList<Integer>();
	int t=0;
	for(int i=0;i<sum;i++){
		t=10+4*i;
		int sequence=ByteIntConvert.toInt(dpData, t+8);
		ackList.add(sequence);
	}
	////#MLog.println("LLLLLLLLLLLLLL "+dp.getLength()+" "+ackList.size());
	t=10+4*sum-4;
	r1=ByteIntConvert.toInt(dpData, t+4+8);
	s1=ByteIntConvert.toInt(dpData, t+8+8);

	r2=ByteIntConvert.toInt(dpData, t+12+8);
	s2=ByteIntConvert.toInt(dpData, t+16+8);

	r3=ByteIntConvert.toInt(dpData, t+20+8);
	s3=ByteIntConvert.toInt(dpData, t+24+8);

	////#MLog.println("aaaaaaaaa"+r3+"kkkkkkk "+s3);
}
 
Example 11
Source File: PingMessage.java    From finalspeed-91yun with GNU General Public License v2.0 5 votes vote down vote up
public PingMessage(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
	pingId=ByteIntConvert.toInt(dpData, 12);
	downloadSpeed=ByteShortConvert.toShort(dpData, 16);
	uploadSpeed=ByteShortConvert.toShort(dpData, 18);
}
 
Example 12
Source File: CloseMessage_Stream.java    From finalspeed-91yun with GNU General Public License v2.0 5 votes vote down vote up
public CloseMessage_Stream(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
	closeOffset=ByteIntConvert.toInt(dpData, 12);
	////#MLog.println("vCloseMessagebbb"+clientId+"v");
}
 
Example 13
Source File: AckListMessage.java    From finalspeed-91yun with GNU General Public License v2.0 5 votes vote down vote up
public AckListMessage(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
	
	
	lastRead=ByteIntConvert.toInt(dpData, 4+8);
	int sum=ByteShortConvert.toShort(dpData, 8+8);
	ackList=new ArrayList<Integer>();
	int t=0;
	for(int i=0;i<sum;i++){
		t=10+4*i;
		int sequence=ByteIntConvert.toInt(dpData, t+8);
		ackList.add(sequence);
	}
	////#MLog.println("LLLLLLLLLLLLLL "+dp.getLength()+" "+ackList.size());
	t=10+4*sum-4;
	r1=ByteIntConvert.toInt(dpData, t+4+8);
	s1=ByteIntConvert.toInt(dpData, t+8+8);

	r2=ByteIntConvert.toInt(dpData, t+12+8);
	s2=ByteIntConvert.toInt(dpData, t+16+8);

	r3=ByteIntConvert.toInt(dpData, t+20+8);
	s3=ByteIntConvert.toInt(dpData, t+24+8);

	////#MLog.println("aaaaaaaaa"+r3+"kkkkkkk "+s3);
}
 
Example 14
Source File: PingMessage2.java    From NSS with Apache License 2.0 5 votes vote down vote up
public PingMessage2(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
	pingId=ByteIntConvert.toInt(dpData, 12);
}
 
Example 15
Source File: DataMessage.java    From NSS with Apache License 2.0 5 votes vote down vote up
public DataMessage(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
	
	sequence=ByteIntConvert.toInt(dpData, 12);
	length=ByteShortConvert.toShort(dpData, 16);
	timeId=ByteIntConvert.toInt(dpData, 18);
	data=new byte[length];
	System.arraycopy(dpData, 22, data, 0, length);
}
 
Example 16
Source File: CloseMessage_Conn.java    From NSS with Apache License 2.0 5 votes vote down vote up
public CloseMessage_Conn(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
}
 
Example 17
Source File: PingMessage.java    From NSS with Apache License 2.0 5 votes vote down vote up
public PingMessage(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
	pingId=ByteIntConvert.toInt(dpData, 12);
	downloadSpeed=ByteShortConvert.toShort(dpData, 16);
	uploadSpeed=ByteShortConvert.toShort(dpData, 18);
}
 
Example 18
Source File: CloseMessage_Stream.java    From NSS with Apache License 2.0 5 votes vote down vote up
public CloseMessage_Stream(DatagramPacket dp){
	this.dp=dp;
	dpData=dp.getData();
	ver=ByteShortConvert.toShort(dpData, 0);
	sType=ByteShortConvert.toShort(dpData, 2);
	
	connectId=ByteIntConvert.toInt(dpData, 4);
	clientId=ByteIntConvert.toInt(dpData, 8);
	closeOffset=ByteIntConvert.toInt(dpData, 12);
	////#MLog.println("vCloseMessagebbb"+clientId+"v");
}