mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
WIP: Worked on new server thread class that would create and store multiple THREADS of connections. Researched Authorative server structures.
Fixed the current structure of the server to work with the old StreamReciever style and hook up to the Stream Parser tags: #story[1047] pair[wmu16, mra106]
This commit is contained in:
@@ -194,6 +194,25 @@ public abstract class Message {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* takes an array of up to 7 bytes in little endian format and
|
||||
* returns a positive long constructed from the input bytes
|
||||
*
|
||||
* @return a positive long if there is less than 8 bytes -1 otherwise
|
||||
*/
|
||||
public static long bytesToLong(byte[] bytes){
|
||||
long partialLong = 0;
|
||||
int index = 0;
|
||||
for (byte b: bytes){
|
||||
if (index > 6){
|
||||
return -1;
|
||||
}
|
||||
partialLong = partialLong | (b & 0xFFL) << (index * 8);
|
||||
index++;
|
||||
}
|
||||
return partialLong;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse an array of bytes
|
||||
* @param data The byte[] to reverse
|
||||
@@ -205,4 +224,5 @@ public abstract class Message {
|
||||
data[right] = (byte) (temp & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user