Class WebSocketUtil

java.lang.Object
io.netty.handler.codec.http.websocketx.WebSocketUtil

final class WebSocketUtil extends Object
A utility class mainly for use by web sockets
  • Field Details

  • Constructor Details

    • WebSocketUtil

      private WebSocketUtil()
      A private constructor to ensure that instances of this class cannot be made
  • Method Details

    • md5

      static byte[] md5(byte[] data)
      Performs a MD5 hash on the specified data
      Parameters:
      data - The data to hash
      Returns:
      The hashed data
    • sha1

      static MessageDigest sha1()
    • sha1

      static byte[] sha1(byte[] data)
      Performs a SHA-1 hash on the specified data
      Parameters:
      data - The data to hash
      Returns:
      The hashed data
    • digest

      private static byte[] digest(FastThreadLocal<MessageDigest> digestFastThreadLocal, byte[] data)
    • base64

      static String base64(byte[] data)
      Performs base64 encoding on the specified data
      Parameters:
      data - The data to encode
      Returns:
      An encoded string containing the data
    • randomBytes

      static byte[] randomBytes(int size)
      Creates an arbitrary number of random bytes
      Parameters:
      size - the number of random bytes to create
      Returns:
      An array of random bytes
    • randomNumber

      static int randomNumber(int minimum, int maximum)
      Generates a pseudo-random number
      Parameters:
      minimum - The minimum allowable value
      maximum - The maximum allowable value
      Returns:
      A pseudo-random number
    • byteAtIndex

      static int byteAtIndex(int mask, int index)