Serializes a message into cluster data @param msg ClusterMessage @return serialized content as byte[] array @throws IOException Serialization error
(Serializable msg)
| 750 | * @throws IOException Serialization error |
| 751 | */ |
| 752 | public static byte[] serialize(Serializable msg) throws IOException { |
| 753 | ByteArrayOutputStream outs = new ByteArrayOutputStream(); |
| 754 | ObjectOutputStream out = new ObjectOutputStream(outs); |
| 755 | out.writeObject(msg); |
| 756 | out.flush(); |
| 757 | return outs.toByteArray(); |
| 758 | } |
| 759 | |
| 760 | /** |
| 761 | * Sets the discard flag for invalid packages. |