public final class RestUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
closeStream(Object stream)
|
static org.mule.runtime.api.metadata.TypedValue<String> |
consumeStringAndClose(Object stream,
org.mule.runtime.api.metadata.MediaType targetMediaType,
Charset targetCharset)
Consumes the contents of the given
stream as a String and closes it. |
static String |
stringValue(Object o)
Transforms a value into a tailored String representation for HTTP requests.
|
static List<org.mule.runtime.api.metadata.TypedValue<String>> |
toList(Iterator<org.mule.runtime.api.metadata.TypedValue<?>> iterator)
Transform an iterator of TypedValue> into a list of TypedValue
|
static org.mule.runtime.api.metadata.TypedValue<String> |
toTypedValue(String value,
org.mule.runtime.api.metadata.MediaType mediaType,
Charset encoding) |
public static void closeStream(Object stream)
stream which can be either a CursorProvider or an InputStream.
Null values or instances of other classes will be ignored.stream - a streampublic static org.mule.runtime.api.metadata.TypedValue<String> consumeStringAndClose(Object stream, org.mule.runtime.api.metadata.MediaType targetMediaType, Charset targetCharset)
stream as a String and closes it.
The stream can be either a CursorStreamProvider or an InputStream. IllegalArgumentException
will be thrown if the stream is an instance of any other class.
Notice that in the case of CursorStreamProvider, this method will close the provider meaning that it will no longer
be able to yield new cursors.
stream - a CursorStreamProvider or an InputStreamtargetCharset - the encoding to use when reading the String and that will be set to the TypedValuetargetMediaType - the media type that will be set to the TypedValueIllegalArgumentException - if stream is not of the expected types.public static List<org.mule.runtime.api.metadata.TypedValue<String>> toList(Iterator<org.mule.runtime.api.metadata.TypedValue<?>> iterator)
iterator - The iterator to consumepublic static String stringValue(Object o)
Copyright © 2023. All rights reserved.