Package utility
Class Util
- java.lang.Object
-
- utility.Util
-
public class Util extends Object
Global Utility Class with static helper methods.- Version:
- 1.0
- Author:
- Frank Giordano
-
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkConnection(ZOSConnection connection)
Check connection for validity.static void
checkNullParameter(boolean check, String msg)
Check for null parameterstatic void
checkStateParameter(boolean check, String msg)
Check for state of parameterstatic String
encodeURIComponent(String str)
Encodes the passed String as UTF-8 using an algorithm that's compatible with JavaScript's encodeURIComponent function.static String
getAuthEncoding(ZOSConnection connection)
Encodes the passed connection String as UTF-8 for usage of the AUTHORIZATION http header.
-
-
-
Method Detail
-
getAuthEncoding
public static String getAuthEncoding(ZOSConnection connection)
Encodes the passed connection String as UTF-8 for usage of the AUTHORIZATION http header.- Parameters:
connection
- ZOSConnection object- Returns:
- The encoded String
-
checkConnection
public static void checkConnection(ZOSConnection connection)
Check connection for validity.- Parameters:
connection
- ZOSConnection object- Throws:
IllegalStateException
- with message Connection data not setup properly
-
checkNullParameter
public static void checkNullParameter(boolean check, String msg)
Check for null parameter- Parameters:
check
- Check for true or false valuemsg
- A String message to display if check is true- Throws:
IllegalArgumentException
- with msg
-
checkStateParameter
public static void checkStateParameter(boolean check, String msg)
Check for state of parameter- Parameters:
check
- Check for true or false valuemsg
- A String message to display if check is true- Throws:
IllegalStateException
- with msg
-
encodeURIComponent
public static String encodeURIComponent(String str)
Encodes the passed String as UTF-8 using an algorithm that's compatible with JavaScript's encodeURIComponent function. Returns incoming string un-encoded if exception occurs.- Parameters:
str
- The String to be encoded- Returns:
- The encoded String or original string
-
-