Package com.neovisionaries.ws.client
Class Misc
java.lang.Object
com.neovisionaries.ws.client.Misc
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
extractHost
(URI uri) (package private) static String
extractHostFromAuthorityPart
(String authority) (package private) static String
static byte[]
getBytesUTF8
(String string) Get a UTF-8 byte array representation of the given string.static Constructor
<?> getConstructor
(String className, Class<?>[] parameterTypes) static Method
static Object
private static void
join
(StringBuilder builder, Collection<?> values, String delimiter) static String
join
(Collection<?> values, String delimiter) static int
max
(int[] values) Find the maximum value from the given array.static int
min
(int[] values) Find the minimum value from the given array.static Object
newInstance
(Constructor<?> constructor, Object... parameters) static byte[]
nextBytes
(byte[] buffer) Fill the given buffer with random bytes.static byte[]
nextBytes
(int nBytes) Create a buffer of the given size filled with random bytes.static String
readLine
(InputStream in, String charset) Read a line from the given stream.static String
toOpcodeName
(int opcode) Convert a WebSocket opcode into a string representation.static String
toStringUTF8
(byte[] bytes) Convert a UTF-8 byte array into a string.static String
toStringUTF8
(byte[] bytes, int offset, int length) Convert a UTF-8 byte array into a string.
-
Field Details
-
sRandom
-
-
Constructor Details
-
Misc
private Misc()
-
-
Method Details
-
getBytesUTF8
Get a UTF-8 byte array representation of the given string. -
toStringUTF8
Convert a UTF-8 byte array into a string. -
toStringUTF8
Convert a UTF-8 byte array into a string. -
nextBytes
public static byte[] nextBytes(byte[] buffer) Fill the given buffer with random bytes. -
nextBytes
public static byte[] nextBytes(int nBytes) Create a buffer of the given size filled with random bytes. -
toOpcodeName
Convert a WebSocket opcode into a string representation. -
readLine
Read a line from the given stream.- Throws:
IOException
-
min
public static int min(int[] values) Find the minimum value from the given array. -
max
public static int max(int[] values) Find the maximum value from the given array. -
join
-
join
-
extractHost
-
extractHostFromAuthorityPart
-
extractHostFromEntireUri
-
getConstructor
-
newInstance
-
getMethod
-
invoke
-