public final class ObjectByteConverter extends Object
This class can also compress stream
Constructor and Description |
---|
ObjectByteConverter() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
base64StringToByteArray(String input) |
static Serializable |
base64StringToSerializable(String input) |
static String |
byteArrayToBase64String(byte[] input) |
static Object |
byteArrayToObject(byte[] input)
Convert the given byte array into the corresponding object.
|
static Object |
byteArrayToObject(byte[] input,
boolean uncompress)
Convert the given byte array into the corresponding object.
|
static Map<String,byte[]> |
mapOfBase64StringToByteArray(Map<String,String> input) |
static Map<String,Serializable> |
mapOfBase64StringToSerializable(Map<String,String> input) |
static Map<String,Serializable> |
mapOfByteArrayToSerializable(Map<String,byte[]> input) |
static Map<String,byte[]> |
mapOfSerializableToByteArray(Map<String,Serializable> input) |
static byte[] |
objectToByteArray(Object obj)
Convert the given Serializable Object into a byte array.
|
static byte[] |
objectToByteArray(Object obj,
boolean compress)
Convert the given Serializable Object into a byte array.
|
static String |
serializableToBase64String(Serializable input) |
public static final byte[] objectToByteArray(Object obj)
obj
- the Serializable object to be compressedpublic static final byte[] objectToByteArray(Object obj, boolean compress)
The returned byteArray can be compressed by setting compress boolean argument value to true
.
obj
- the Serializable object to be compressedcompress
- true if the returned byteArray must be also compressed, false if no compression is required.public static Object byteArrayToObject(byte[] input)
input
- the byteArray to be convert as an object.public static Object byteArrayToObject(byte[] input, boolean uncompress)
The given byteArray can be uncompressed if it has been compressed before.
input
- the byteArray to be convert as an object.uncompress
- true if the given byteArray must be also uncompressed, false if no compression was made on it.public static String serializableToBase64String(Serializable input)
public static String byteArrayToBase64String(byte[] input)
public static byte[] base64StringToByteArray(String input)
public static Serializable base64StringToSerializable(String input)
public static Map<String,byte[]> mapOfBase64StringToByteArray(Map<String,String> input)
public static Map<String,Serializable> mapOfBase64StringToSerializable(Map<String,String> input)
public static Map<String,Serializable> mapOfByteArrayToSerializable(Map<String,byte[]> input)
public static Map<String,byte[]> mapOfSerializableToByteArray(Map<String,Serializable> input)