Package org.springframework.amqp.utils
Class SerializationUtils
- java.lang.Object
-
- org.springframework.amqp.utils.SerializationUtils
-
public final class SerializationUtils extends Object
Static utility to help with serialization.- Author:
- Dave Syer, Gary Russell
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkAllowedList(Class<?> clazz, Set<String> patterns)
Verify that the class is in the allowed list.static Object
deserialize(byte[] bytes)
Deserialize the bytes.static Object
deserialize(InputStream inputStream, Set<String> allowedListPatterns, ClassLoader classLoader)
Deserialize the stream.static Object
deserialize(ObjectInputStream stream)
Deserialize the stream.static byte[]
serialize(Object object)
Serialize the object provided.
-
-
-
Method Detail
-
serialize
public static byte[] serialize(Object object)
Serialize the object provided.- Parameters:
object
- the object to serialize- Returns:
- an array of bytes representing the object in a portable fashion
-
deserialize
public static Object deserialize(byte[] bytes)
Deserialize the bytes.- Parameters:
bytes
- a serialized object created- Returns:
- the result of deserializing the bytes
-
deserialize
public static Object deserialize(ObjectInputStream stream)
Deserialize the stream.- Parameters:
stream
- an object stream created from a serialized object- Returns:
- the result of deserializing the bytes
-
deserialize
public static Object deserialize(InputStream inputStream, Set<String> allowedListPatterns, ClassLoader classLoader) throws IOException
Deserialize the stream.- Parameters:
inputStream
- the stream.allowedListPatterns
- allowed classes.classLoader
- the class loader.- Returns:
- the result.
- Throws:
IOException
- IO Exception.- Since:
- 2.1
-
-