Class ClientUtils

    • Constructor Detail

      • ClientUtils

        public ClientUtils()
    • Method Detail

      • closeQuietly

        public static void closeQuietly​(InputStream stream)
        Quietly close a given stream, suppressing exceptions.
        Parameters:
        stream - Stream to close
      • stringToStream

        public static InputStream stringToStream​(String s)
        Convert a given String to an InputStream.
        Parameters:
        s - a string
        Returns:
        an input stream on the string
      • streamToString

        public static String streamToString​(InputStream inputStream)
        Convert a given InputStream to a String.
        Parameters:
        inputStream - an input stream
        Returns:
        the string in the input stream
      • parameterizedType

        public static ParameterizedType parameterizedType​(Type ownerType,
                                                          Type rawType,
                                                          Type... typeArguments)
        Helper for constructing parameterized types.
        Parameters:
        ownerType - the owner type
        rawType - the raw type
        typeArguments - the type arguments
        Returns:
        the parameterized type object
      • splitFunction

        public static String[] splitFunction​(String function)
        Extract the module and function name from the function string based on '.' . In case of e.g. "test.ping", this method will return String array {'test','ping'}
        Parameters:
        function - string containing module and function name (e.g. "test.ping")
        Returns:
        String array containing module name as 1st element and function name as 2nd
        Throws:
        IllegalArgumentException - if a given function string does not contain a '.'