public final class ContentUtils extends Object
GXInboundResponse's content.| Constructor and Description |
|---|
ContentUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
fromJson(byte[] bytes,
Class<T> raw)
Deserializes the specified Json bytes into an object of the specified class
|
static <T> T |
fromJson(String json,
Class<T> raw)
Deserializes the specified Json bytes into an object of the specified class
|
static byte[] |
toByteArray(InputStream input)
Gets the contents of an
InputStream as a byte[]. |
static byte[] |
toByteArray(Object obj)
Converts an object to an array of bytes
|
Object |
toObject(byte[] data)
Converts the array of bytes into an object.
|
static <T> T |
toObject(InputStream inputStream,
Class<T> class1) |
static String |
toString(byte[] bytes) |
public static byte[] toByteArray(Object obj) throws IOException
obj - IOExceptionpublic static <T> T toObject(InputStream inputStream, Class<T> class1) throws IOException, ClassNotFoundException
inputStream - class1 - IOExceptionClassNotFoundExceptionpublic Object toObject(byte[] data) throws IOException, ClassNotFoundException
data - IOExceptionClassNotFoundExceptionpublic static byte[] toByteArray(InputStream input) throws IOException
InputStream as a byte[].input - the InputStream to read fromNullPointerException - if the input is nullIOException - if an I/O error occurspublic static String toString(byte[] bytes)
bytes - public static <T> T fromJson(byte[] bytes,
Class<T> raw)
throws Exception
T - the type of the desired objectjson - the string from which the object is to be deserializedclassOfT - the class of TException - if the deserialization failspublic static <T> T fromJson(String json, Class<T> raw) throws Exception
T - the type of the desired objectjson - the string from which the object is to be deserializedraw - the class of TException - if the deserialization failsCopyright © 2018. All Rights Reserved.