public final class ContentUtils extends Object
| Constructor and Description |
|---|
ContentUtils() |
| Modifier and Type | Method and Description |
|---|---|
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 - Copyright © 2020. All Rights Reserved.