Package com.suse.salt.netapi.utils
Class ClientUtils
- java.lang.Object
-
- com.suse.salt.netapi.utils.ClientUtils
-
public class ClientUtils extends java.lang.ObjectUtilities forSaltClient.
-
-
Constructor Summary
Constructors Constructor Description ClientUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseQuietly(java.io.InputStream stream)Quietly close a given stream, suppressing exceptions.static java.lang.reflect.ParameterizedTypeparameterizedType(java.lang.reflect.Type ownerType, java.lang.reflect.Type rawType, java.lang.reflect.Type... typeArguments)Helper for constructing parameterized types.static java.lang.String[]splitFunction(java.lang.String function)Extract the module and function name from the function string based on '.' .static java.lang.StringstreamToString(java.io.InputStream inputStream)Convert a givenInputStreamto aString.static java.io.InputStreamstringToStream(java.lang.String s)Convert a givenStringto anInputStream.
-
-
-
Method Detail
-
closeQuietly
public static void closeQuietly(java.io.InputStream stream)
Quietly close a given stream, suppressing exceptions.- Parameters:
stream- Stream to close
-
stringToStream
public static java.io.InputStream stringToStream(java.lang.String s)
Convert a givenStringto anInputStream.- Parameters:
s- a string- Returns:
- an input stream on the string
-
streamToString
public static java.lang.String streamToString(java.io.InputStream inputStream)
Convert a givenInputStreamto aString.- Parameters:
inputStream- an input stream- Returns:
- the string in the input stream
-
parameterizedType
public static java.lang.reflect.ParameterizedType parameterizedType(java.lang.reflect.Type ownerType, java.lang.reflect.Type rawType, java.lang.reflect.Type... typeArguments)Helper for constructing parameterized types.- Parameters:
ownerType- the owner typerawType- the raw typetypeArguments- the type arguments- Returns:
- the parameterized type object
-
splitFunction
public static java.lang.String[] splitFunction(java.lang.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:
java.lang.IllegalArgumentException- if a given function string does not contain a '.'
-
-