Top Description Fields Constructors Methods
io.netty5.handler.codec.http.websocketx

pack-priv final Class WebSocketUtil

extends Object
Class Inheritance
Imports
io.netty5.util.concurrent.FastThreadLocal, java.security.MessageDigest, .NoSuchAlgorithmException, java.util.Base64, java.util.concurrent.ThreadLocalRandom

A utility class mainly for use by web sockets.

Field Summary

Modifier and TypeField and Description
private static final FastThreadLocal<MessageDigest>
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static String

Returns:

an encoded string containing the data
base64
(byte[]
The data to encode
data
)

Performs base64 encoding on the specified data.

pack-priv static String
pack-priv static byte[]

Returns:

an array of random bytes
randomBytes
(int
the number of random bytes to create
size
)

Creates an arbitrary number of random bytes.

pack-priv static byte[]

Returns:

the hashed data
sha1
(byte[]
The data to hash
data
)

Performs a SHA-1 hash on the specified data.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

SHA1back to summary
private static final FastThreadLocal<MessageDigest> SHA1
V13_ACCEPT_GUIDback to summary
private static final String V13_ACCEPT_GUID

Constructor Detail

WebSocketUtilback to summary
private WebSocketUtil()

Method Detail

base64back to summary
pack-priv static String base64(byte[] data)

Performs base64 encoding on the specified data.

Parameters
data:byte[]

The data to encode

Returns:String

an encoded string containing the data

calculateV13Acceptback to summary
pack-priv static String calculateV13Accept(String nonce)
randomBytesback to summary
pack-priv static byte[] randomBytes(int size)

Creates an arbitrary number of random bytes.

Parameters
size:int

the number of random bytes to create

Returns:byte[]

an array of random bytes

sha1back to summary
pack-priv static byte[] sha1(byte[] data)

Performs a SHA-1 hash on the specified data.

Parameters
data:byte[]

The data to hash

Returns:byte[]

the hashed data