-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Hello Mr. Blink, your code line 430 as shown in this link
https://github.com/blinkdog/websocket/blob/master/src/main/java/com/pmeade/websocket/io/WebSocketServerInputStream.java#L430
for (int i = 0; i < NUM_OCTET_64; i++) {
payloadLength |=
inputStream.read() << (NUM_OCTET_64 - 1 - i) * OCTET;
}the result of inputStream.read() should be casted to long first, since bitwise OR between Long number and Integer number will result in Integer number.
you may check this code snippet
long payloadLength = 0L;
int[] testData = new int[]{1,1,1,1,1,1,1,1};
for(int i=0; i<8; i++){
long byteN = testData[i];
payloadLength = payloadLength | byteN << (7 - i) * 8;
System.out.print("i[" + i + "] payloadLength: ");
printBinaryform(payloadLength);
System.out.print("\r\n="+payloadLength);
System.out.println();
}following is the output of code above:
long payloadLength = 0L;
int[] testData = new int[]{1,1,1,1,1,1,1,1};
for(int i=0; i<8; i++){
payloadLength = payloadLength | testData[i] << (7 - i) * 8;
System.out.print("i[" + i + "] payloadLength: ");
printBinaryform(payloadLength);
System.out.print("\r\n="+payloadLength);
System.out.println();
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels