Class ClientUtils
java.lang.Object
com.suse.salt.netapi.utils.ClientUtils
Utilities for
SaltClient.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseQuietly(InputStream stream) Quietly close a given stream, suppressing exceptions.static ParameterizedTypeparameterizedType(Type ownerType, Type rawType, Type... typeArguments) Helper for constructing parameterized types.static String[]splitFunction(String function) Extract the module and function name from the function string based on '.' .static StringstreamToString(InputStream inputStream) Convert a givenInputStreamto aString.static InputStreamConvert a givenStringto anInputStream.
-
Constructor Details
-
ClientUtils
public ClientUtils()
-
-
Method Details
-
closeQuietly
Quietly close a given stream, suppressing exceptions.- Parameters:
stream- Stream to close
-
stringToStream
Convert a givenStringto anInputStream.- Parameters:
s- a string- Returns:
- an input stream on the string
-
streamToString
Convert a givenInputStreamto aString.- 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 typerawType- the raw typetypeArguments- the type arguments- Returns:
- the parameterized type object
- See Also:
-
splitFunction
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 '.'
-