public static String toOpcodeName ( int opcode ) { switch ( opcode ) { case CONTINUATION : return "CONTINUATION" ; case TEXT : return "TEXT" ; case BINARY : return "BINARY" ; case CLOSE : return "CLOSE" ; case PING : return "PING" ; case PONG : return "PONG" ; default : break ; } if ( 0x1 <= opcode && opcode <= 0x7 ) { return String . format ( "DATA(0x%X)" , opcode ) ; } if ( 0x8 <= opcode && opcode <= 0xF ) { return String . format ( "CONTROL(0x%X)" , opcode ) ; } return String . format ( "0x%X" , opcode ) ; }
Convert a WebSocket opcode into a string representation .