Skip to content

Commit d06cff2

Browse files
committed
update code : change if to switch case
1 parent 9518c2a commit d06cff2

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/main/java/org/java_websocket/drafts/Draft_6455.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -660,19 +660,16 @@ private void translateSingleFrameCheckPacketSize(int maxpacketsize, int realpack
660660
* @return byte that represents which RSV bit is set.
661661
*/
662662
private byte getRSVByte(int rsv) {
663-
if (rsv == 1) // 0100 0000
664-
{
665-
return 0x40;
666-
}
667-
if (rsv == 2) // 0010 0000
668-
{
669-
return 0x20;
670-
}
671-
if (rsv == 3) // 0001 0000
672-
{
673-
return 0x10;
663+
switch (rsv) {
664+
case 1 : // 0100 0000
665+
return 0x40;
666+
case 2 : // 0010 0000
667+
return 0x20;
668+
case 3 : // 0001 0000
669+
return 0x10;
670+
default:
671+
return 0;
674672
}
675-
return 0;
676673
}
677674

678675
/**

0 commit comments

Comments
 (0)