Package uk.ac.manchester.spinnaker.alloc
Class IOUtils
java.lang.Object
uk.ac.manchester.spinnaker.alloc.IOUtils
Utility wrappers for I/O.
- Author:
- Donal Fellows
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> Tdeserialize(byte[] bytes, Class<T> cls) Convert a serialized object into its normal form.static byte[]Convert a serializable object into its serialized form.
- 
Method Details- 
serializeConvert a serializable object into its serialized form.- Parameters:
- obj- The object to serialize.
- Returns:
- The serialized form.
- Throws:
- IOException- If the object isn't serializable.
 
- 
deserializepublic static <T> T deserialize(byte[] bytes, Class<T> cls) throws ClassNotFoundException, IOException Convert a serialized object into its normal form. Only call on data that is trusted!- Type Parameters:
- T- The type of the response.
- Parameters:
- bytes- The serialized data.
- cls- The class that the object is expected to conform to.
- Returns:
- The deserialized object.
- Throws:
- IOException- If the object isn't deserializable.
- ClassNotFoundException- If the data doesn't represent a known class.
- ClassCastException- If the data is not an object of the expected class.
 
 
-