Package utility

Class Util


  • public class Util
    extends Object
    Global Utility Class with static helper methods.
    Version:
    1.0
    Author:
    Frank Giordano
    • Constructor Detail

      • Util

        public Util()
    • 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 value
        msg - 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 value
        msg - 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